Questions tagged [python-2.6]

For issues that are specific to Python 2.6. If your question applies to Python in general, use the tag [python].

Use this tag if your question is specifically about Python 2.6. If your question applies to Python in general, use the tag . If your question applies to Python 2.x but not to Python 3, use the tag . If you aren't sure, tag your question and mention which version you're using in the body of your question.

1318 questions
-3
votes
1 answer

Python can't match word at the of of the string(regex module)

I have the following code: p = re.compile(ur'(.{0,20})\b(\d{2,4})[^\d]{1,5}(\d{3,4})[^\d]{1,5}(\d{4,6})\b(.{0,20})', re.IGNORECASE) test_str = u"223-356-7890 asdasdasdas dfgdfgdf" print re.match(p, test_str) It matches the 223-356-7890 good, but…
-3
votes
1 answer

Store input based on computer and change stored input on command

Fixed code; if os.path.isfile(external_file): with open(external_file) as in_f: name = in_f.read() else: name = raw_input("What's your name?") with open(external_file, "w") as out_f: out_f.write(name) The problem is. It…
-3
votes
2 answers

how to write to a text file using python ?

I am trying to output a full for iteration. The output should be in a text file. How should I code for that ? The output should look like : Iteration 1 values --------> val1 < tab > val2 < tab > val3 Iteration 2 values --------> val4 < tab > val5 <…
dsinha
  • 19
  • 7
-4
votes
1 answer

Python Backup file script problems

I've been working on a backup script below, copying files from one server to another, with several requirements. The code is below. Any help? And I have a sample test input. import arcpy # Import arcpy…
-4
votes
0 answers

How do I install PyYAML and why is it giving this "SyntaxError: invalid syntax" error?

I need to install PyYAML for a program but I get an error whenever I try to install it. When I type pip install yaml or pip install PyYAML into the Python 2.6 command line, it gives me this error: File "", line 1 pip install yaml …
-4
votes
1 answer

Update python version from 2.6.5 to 2.7.9 in Windows

In one of the remote computers i'm using there's a python version of 2.6.5 and I want to upgrade it to 2.7.9. It is currently located under C:\Python26 . I need to upgrade it in such way that will direct the PATH to the newer python (meaning when I…
slashms
  • 928
  • 9
  • 26
-4
votes
2 answers

PYTHON - text store

My last question was asked wrong. If my code is import os #hard code the path to the external file external_file = '/name.txt' #if file exists, use it to load name, else ask user if os.path.isfile(external_file): name =…
-4
votes
1 answer

How can i create a dynamic dictionary in a Python script sharing its contents with another script?

I have a Python dictionary as follows dictvvalue={'a':'1','b':'2','c':{'d':'5','e':'6'}} My intention is to save this Python dictionary for use by another Python script. I have to load this dictionary to the other script as a dictionary rather…
mystack
  • 4,910
  • 10
  • 44
  • 75
-5
votes
1 answer

Extract the a value from this line

i know this has been asked many times before but I am struggling to extract the middle of the bellow line id1=({'children': '', 'edgeParameter': 1.0, 'id': 8, 'isOutOfDate': False, 'name': 'Datum pt-5', 'parents': '1&', 'path': 'unknown', 'sketch':…
manish449
  • 511
  • 3
  • 11
  • 17
-5
votes
1 answer

How function is getting called without defining in python

Here is the program: import sys def IndexSearchString(): ''' This function search a string in a password file through index and gives the result. :return: none :return type: none :author: Neeraj ''' fieldindex =…
Neeraj Lad
  • 59
  • 2
  • 10
-5
votes
1 answer

Reverse a dictionary order python

I have a python dictionary as follows: DictValue = { 'Event1': {}, 'Event2': { 'copy3': { 'SourcePath': 'souce3', 'DestPath': 'dest3', 'Platform': u 'Debug|Win32' }, 'copy2': { 'SourcePath': 'souce3', …
-6
votes
1 answer

Python how to use filecmp.cmp to do a non shallow comparison?

From http://docs.python.org/release/2.6.2/library/filecmp: filecmp.cmp(f1, f2[, shallow]) Compare the files named f1 and f2, returning True if they seem equal, False otherwise. Unless shallow is given and is false, files with identical os.stat()…
markmnl
  • 11,116
  • 8
  • 73
  • 109
-7
votes
1 answer

Import two modules with same name at top of PYTHONPATH elements

I'll shorten the notation. I have PYTHONPATH=/path1/dir1:/path2/dir2 Structures: /path1/dir1/ README muggle.py ... utils/ /path2/dir2/ __init__.py utils/ __init__.py pkg2/ __init__.py …
Prune
  • 76,765
  • 14
  • 60
  • 81
1 2 3
87
88