-
Replied To a Post in Splitting a csv up by a certain value
pyTony's question is valid. Why split it up? But if you must, then my code above ought to work with a couple of changes. I forgot to open the output … -
Replied To a Post in Splitting a csv up by a certain value
I think there are 2 ways depending on just how big the file really is. If it can all be read into memory, then I suggest: data=[] with open(<csv file … -
Replied To a Post in displaying the values in text box using tkinter
It seems this, `blue = IntVar()`, defines "blue". I've had poor results trying to use any widget's textvariable in Tkinter (as opposed to Tk). I think you would need to … -
Replied To a Post in How to delete a list from a set?
From the [Library Reference](http://docs.python.org/2/library/stdtypes.html#set-types-set-frozenset): > The set type is mutable — the contents can be changed using methods like add() and remove(). -
Replied To a Post in Questions About Auxiliary Functions
Here's my 2 cents: Let's say I have a function that turns Year,month,day into day of year: def ymd2doy(y,m,d): if y<100: y+=2000 ly=0 if (y-2000)%4==0: ly=1 md=(31,28+ly,31,30,31,30,31,31,30,31,30,31) for i in … -
Replied To a Post in How do I enter a function to be calculated
Also, you cast Y to float() but not X so it remains a string: 2*"1"="11" [never mind: I see you're in v3.3 so input should take care of the conversion … -
Replied To a Post in How do I enter a function to be calculated
It can be done with the eval() builtin function. **However!!!** it is very dangerous to allow users to input any old thing and then evaluate that input. It would be … -
Replied To a Post in attributError : 'str ' object has no attribute 'allatom'
Unless I missed it, it seems you haven't posted your code. It would be easier (read: maybe possible) to help if we could see what you are trying to do. … -
Replied To a Post in How to open one .py file into another .py file?
I'm not sure what your particular needs might be but the standard way of accessing another script is "import <filename>". For that to work, the accessed file either needs to … -
Replied To a Post in Change the First Character of List word to Upper Case
Maybe: with open('c:\FLOUpper.txt', 'r') as infile,open('c:\FLOLower.txt', 'w') as outfile: data = infile.readlines() data = [i.capitalize() for i in data] outfile.write(data) -
Replied To a Post in please help.. import into a list
get rid of "print(input(..." `name1=input("what is your name: ")` -
Replied To a Post in Binary to Decimal in Python - And Vice Versa
Take a look at the 'struct' module. -
Replied To a Post in Python code for linear search and binary search using txt file
@slate (not to hijack the post but...) Why? I've seen that construction but why is it preferred? -
Replied To a Post in Classes and Parameters
There are a couple of choices. You can initalize the object with some attiributes and include methods for changing them: #class test class cA(object): a = 42 def chA(self,b): self.a … -
Replied To a Post in Python code for linear search and binary search using txt file
100000 isn't that big. Why not just: f=open(<your text file>) for line in f: if <your search string> in line: <do your thing> f.close() or even: f=open(<your text file>) strA=f.read() … -
Replied To a Post in Delete Key in dict if val = 0
>>> d={"key1":3,"key2":18,"key3":8} >>> d["key2"]=0 >>> d {'key3': 8, 'key2': 0, 'key1': 3} >>> s=d.items() >>> s [('key3', 8), ('key2', 0), ('key1', 3)] >>> for i in s: ... if i[1]==0: … -
Replied To a Post in Issue with "while" loop
So you want to embed the second loop **inside** the first loop? That's not the way it is now. -
Replied To a Post in multiples in desc order in list
Are you allowed to use list comprehension which is an implicit for loop? [i*6 for i in xrange(3,0,-1)] [18, 12, 6] -
Replied To a Post in comparing domain name in two text files and print in to third one
I'm not sure how you're supposedto use re.finditer but not this way. The elements of the returned list are match objects, not strings. I suggest you use findall instead. If … -
Replied To a Post in split text message wuth multiple dilimeter
Let's say your string, *QUESTION DEFINITIONS var P1_1 = new Array("P1_1", "An audit charter should:", "A. be dynamic and change often to coincide with the changing nature of technology and … -
Replied To a Post in Cannot find Tkinter on Windows
Did you use ActiveState to get Python? If not, what did you use? -
Replied To a Post in split text message wuth multiple dilimeter
So it seems that "QUESTION DEFINITIONS var P1_1 = new Array... level and therefore would not include specific audit objectives or procedures.", 4, 1);" is a string that does indeed … -
Replied To a Post in split text message wuth multiple dilimeter
What you've shown is an array (list), that is, it's already split. What are you starting with? -
Replied To a Post in numerology code
Not to endorse or refute the underlying concept, if you provided the rules (eg: number of vowels is greater than twice the square root of the number of "s"s) I'm … -
Replied To a Post in Python problem with counting items text file
If the file is small enough (and that depends on your memory, usually pretty big) to be read all at one go: f=open(<text file name>) strdata=f.read() f.close() c=strdata.count("abc")
The End.