761 Posted Topics
Re: If your open() call is "not working" perhaps you are mistaken with which working directory you're using. Try a simple os.getcwd() call to see where the files are being created. | |
Re: I'm not positive about this but I would assume that some of the time is consumed in the buffering of the file write process. Perhaps in stead of an open file handle you could try an IOString, which after the operation is complete you could write to file in one … | |
Re: [QUOTE=programmingnoob;645061][code=python] fin = open ('input.bin') fout = open ('output.bin') fin.readline() x = fin.readlines (1) str (x) [/code][/QUOTE] open( file_name ) defaults to read mode. You want open( file_name, 'w' ) for your output file so that you may write to it. This first part is moving the file cursor. Are … | |
Re: Building off of paulthom12345's code... [code=python] import random, sys words = ['sprinkles', 'computer', 'mouse', 'shooter', 'edge', 'guard', 'python'] myword = random.choice(words) guesses = "aeiou" turns = 10 print "Do you want to play a game of hangman?" play = raw_input('Answer (y) yes or (n) no:') if play == 'y': print … | |
Re: [QUOTE=woooee;644673]Sorry, I misunderstood. The only way I know of is to pass it as an arg to the script being executed. Something like: subprocess.call( 'program_name m', shell=True) The program being executed would have to examine sys.argv to find it.[/QUOTE] This would not allow him to use the class members or … | |
Greetings All, Here is my filled-out questionnaire from the original (pre-Comm. Intro. forum) thread: Name: James Nickname: Jimmy Height: 5'10'' Weight: 182 Hair: Brown Eyes: Blue Location: NC Currently, hoping to move pack to PA within a few years Age: 22 Hobbies: Listening to music, playing the video games, going … | |
Re: For superscript you could use: [code=python] >>> print '\xb2' ² >>> print '\xb3' ³ [/code] I'm not so sure about subscript though. Just try typing into your interpreter: [code=python] >>> a = '<your_character_here>' >>> a '\<escaped_version_of_your_character>' [/code] | |
Re: [QUOTE=ymf;639567] What I dont get is what these code blocks do: [ICODE] def set_fname(self, fname): self._fname = fname def set_lname(self, lname): self._lname = lname [/ICODE] What exactly does the set_fname and set_lname do? and how come the self._fname and self._lname are inaccessible?[/QUOTE] Those blocks of code reassign the value of … | |
![]() | Re: [QUOTE=leegeorg07;641705]how could i fix this?[/QUOTE] [ICODE]from distutils.core import setup, import, py2exe[/ICODE] When you import multiple modules you need to separate with commas. Or you could just do: [ICODE]from distutils.core import *[/ICODE] to get everything within distutils.core |
Re: im havin trouble with my c programming assignment, i was wondering if someone could do i for me as i have broken my head over this for weeks and haven't been able to do it. i am willing to pay up to 50-60 australian dollars to anyone who can do … |
The End.