Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.

learn more… | top users | synonyms (2) | python jobs

1
vote
0answers
13 views

How to read text file with 1Ah char in it?

I have a file, which is an assembly source with comments. These comments contain 1Ah character. It is a control character, the "substitute", but it also prints a nice right arrow in DOS, so someone ...
1
vote
0answers
11 views

Python to C++ Character encoding

I have a C++ program that uses the Python C/API to call Python scripts for DB info, but the data received is not encoded in the right way. This is in France, so my data has accents and other ...
0
votes
0answers
26 views

a do loop within a do loop no giving the correct outputfiles/images

I am writing a piece of code which requires me to input get information about this image form a starfile. Then print out a smaller image using pyfits. this code works perfectly when I do it with one ...
0
votes
0answers
39 views

Is this necessary [duplicate]

I'm still semi new to python and all over the place in source code, I see this code: if __name__ == '__main__': main() What does it mean exactly? Is it something I should be using in every ...
0
votes
0answers
3 views

Delete a saved Image in Python on Raspberry Pi with OpenCV

I'm programming a Lego sorter machine. I using the following hardware: Raspberry Pi and a Piface I/O module. On the Raspberry runs OpenCV 2.4.1 and the script is written in Python. The following ...
0
votes
0answers
28 views

Command line arguments as variable definition in Python

I'm trying to construct a (kind of template/wrapper) script, which is called with some undefined options > the_script.py --foo=23 --bar=42 --narf=fjoord which then creates a variable called ...
2
votes
0answers
59 views

very VERY newbie python user needing help w/ running a command

I've found myself having to use a python script to access a webarchive. What I have is a 'megawarc' web archive file from http://archive.org/details/archiveteam-fanfiction-warc-11. I need to ...
1
vote
0answers
6 views

What does StructMeta mean in an error message, and how do I fix it?

I obtained the error message below in a Python program using Gtk.TreeStore and its associated classes. TypeError: Expected Gtk.TreeIter, but got StructMeta The error was generated immediately ...
-3
votes
0answers
20 views

Android Sockets send and reveive [closed]

I have a Python program running as a Server on a computer, and I want to connect to it on my Android phone to send and receive data. The server side is using sockets where it can receive data from the ...
2
votes
0answers
17 views

File modification times not equal after calling shutil.copystat(file1, file2) (under Windows)

I run the following code with Python 2.7.5. under Windows: import os, shutil, stat, time with open('test.txt', 'w') as f: pass # create an arbitrary file shutil.copy('test.txt', 'test2.txt') # copy ...
0
votes
1answer
32 views

removing mysterious line break python

I have this code that runs through lines in text file like this: 09824747 18 n 02 archer 0 bowman 0 003 @ 09640897 n 0000 ~ 10290474 n 0000 ~i 10718145 n 0000 | a person who is expert in the ...
1
vote
1answer
56 views

How to sort dict?

I have dict with structure like this: my_dict[object_1] = {'alfa': '1', 'beta': '2', 'etc': '3'} my_dict[object_2] = {'alfa': '5', 'beta': '9', 'etc': '1'} my_dict[object_3] = {'alfa': '7', 'beta': ...
0
votes
2answers
17 views

how to iterate over all files in path?

I am trying to iterate over all the text files in a specific path as so: path = "c:\\Python27\\test" with open(path+'\\*.txt') as fin: print 'test' but this returns: [Errno 22] invalid mode ...
0
votes
0answers
12 views

Pyparsing - zero or one from a group

How would I get zero or only one of each tokens out of a group of tokens? They can be in any order. Say this is my code: def parseFunc(self, string): firstToken = CaselessKeyword("KeyWordOne") ...
0
votes
2answers
18 views

use search field in Django

I have a model like: class Job(models.Model): title=models.CharField(max_length=40) genre=models.ManyToManyField(JobGenre, through='GenreToJob') creator=models.ForeignKey(Customer) ...

1 2 3 4 5 13033
15 30 50 per page