3,386 Posted Topics
Re: And the whole thing does just: with open('savetonight.txt') as f: print f.read().lower() | |
Re: py2sis should support autostart since version 1.4.1, quote Changes in 1.4.1 from 1.4.0: ----------------------------- * telephone module improved * position module improved * autostart support added to py2sis It is part of [Ensymble](https://code.google.com/p/ensymble/wiki/Welcome) You must have sis officially signed: --autostart -g Flag to control automatic startup of the application. On … | |
Re: Read the documentation of os module to find suitable command and use a loop and string formatting to do zero padded number: print('%03i.txt' % 5) Output: 005.txt | |
Re: clrscr is not standard c, this is just replacing normal loop with recursion, you can allways do that without too much difficulty, usually with increased memory use and running time. I can not see anything tricky here.How about not allowing recursion also and producing 1024 messages fixed. Maybe slightly more … ![]() | |
Re: print('Player %i:' % x) | |
Re: p[1] and p[3] are same ord("O") so calculation has no effect. | |
| |
Re: It may well be that **patience** is more essential property than being excellent programmer. | |
Re: This is string array, not number array! array=['NaN', '20', '383.333', 'NaN', 'NaN', 'NaN', '5', '100', '129', '122.5', 'NaN', 'NaN'] | |
Re: start /MIN calc also does not start minimized from command line, so it must be problem with the program started, not the command. The wordpad starts minimized with your code and full path (as it is not in PATH in my computer). | |
Re: >>> data = [[278,278,-1,[25076,u'name',3,6,u'',0,0,1,[0,0,None,5]]]] >>> data[0][:3] [278, 278, -1] | |
Re: lines 1 and 2, you should not write output in case input file is missing in first section. | |
Re: Add to beginning from __future__ import print_function You could use the Python2 style print, but learning Python3 style is worth it as it is more flexible and compatible with Python3. | |
Re: You forgot the event parameter from the callback function. | |
My snippet for code snippet competition http://www.daniweb.com/software-development/python/code/426990/split-string-except-inside-brackets-or-quotes is completely messed up. System clitch? | |
![]() | Re: You can also remove your details from your user page and disable the emails from Daniweb, no need to delete account. |
Re: low, high = 10, 100 values = [12, 14, -34, 25, 200, 23, -23, 45, 23] for i in range(1,len(values)-1): if values[i] < low or values[i] > high: # assuming that first value and last value are not off # and neighbouring values are not off values[i] = (values[i-1] + … | |
Re: You need correct indention. Then you can post any code in a **Code** block. | |
Re: Can not say anything, as I do not understand what you are talking about. No data. | |
Re: I just wander how it deals with important issue when you should maybe use language string processing features instead, or parser (eg html). | |
Re: You give very little information on your data, but for what you need the re for? print '_'.join(s for s in "[ k '0 ir e ]".split() if s.isalpha()) # Output: # k_ir_e >>> | |
Re: Concratulations on your first code snippet deceptikon! #define TEST_DRIVER #ifdef TEST_DRIVER This is obviously allways defined, so I assume the purpose is to comment out or remove the define if done debugging. Maybe that could be left for a [command line option to compiler](http://www.rapidtables.com/code/linux/gcc/gcc-d.htm) defining TEST_DRIVER but that of course … | |
Re: Yes, looks like you Walt have around 10 threads outside Community Center. It is natural for (hu)man to be shy on needing to ask, but really, when it was such a terrible thing for your image? Compare to the times you really should have asked and became ashamed you didn't! … | |
Re: Seems that teacher already gave you advice., follow first those. | |
Re: Bubble sort is really bad performer and implementing insertion or selection sort instead is not any harder. Best is of course to use the sort from algorithm instead of reinventing the wheel. | |
Re: You can also use strip (which is very fast, fastest pandigital check is for example by using lengths and strip('012356789')) # -*- coding: latin1 -*- from string import letters def is_alpha_space(name): return False if not name.strip() else not name.strip(letters+' ') name = "Väinö Veijalainen" print(is_alpha_space(name)) # True name = "Mark … | |
Because of [the course](https://www.edx.org/courses/BerkeleyX/CS169.1x/2012_Fall/about) I think to take to improve employment changes by SaaS, Ruby and Rails and basic agile techniques, I looked little the Ruby forum. Unfortunately it seemed in quite a sorry state some months old questions unanswered. Even there was a related article from one of them … | |
Re: from __future__ import print_function item1, item2 = 'abc', 'def' print(item1, end='') print(item2) | |
![]() | Re: You must tell more clearly what would be expected output. There is also three kinds of IAV bits of info on lines: "DHP of IAV" "IHP of IAV" and "IAV" >>> if 'IAV' in "PA,IAV protein,AC0T9,DHP of IAV,2znl-A+z327-A": print('IAV in line') IAV in line >>> |
Re: You should save the split lines, not do readlines and overwrite variable with split data leaving the last lines split data in variables. Indention and variables of line 18 does not make sense. | |
Re: You do not call \__init__ explicitely like you do at line 113, and it has no return value, but the returned value is the object created. You are not using the game instance to anything, so why the class? You are doing strange chain of action from \__init__ return through … | |
Re: I unfortunately do not know so deeply to csv module, but maybe you trying to do something like this (without file input to leave something to you also to do): from collections import OrderedDict data1 = """ 1,19.0,18.2,22.4 2,8.4,9.4,10.2 4,22.2,2.5,3.1 7,3.2,6.1,4.3 10,3.1,4.2,33.7 11,3.7,23.8,23.4 """.splitlines() data2 = """ 1,4.2,7.3,9.5 2,4.1,8.4,9.2 4,2.3,4.6,3.2 … | |
Re: If I understand correctly, question is about https://developers.google.com/appengine/ | |
Re: > plist = [float(x) for x in item[start : end]] #having trouble with blanks You could add default value like plist = [(float(x) if x else default) for x in item[start:end]] | |
Re: Sure, if you just post errors you are getting and explain your problem. | |
Re: It's called palindrome and easiest is to just comparenstrimg with reversed string. But your example GUA....GUG is not one! | |
Here is slow brute force way to find the largest palindromic product of three digit integers. You could do loop and break out of it if you go under the smaller number (the second one) of best solution found so far to be more efficient etc. | |
Re: @Lardmeister: So do I oldnames = ','.join("""Mary,Helen,Margaret,Anna,Ruth Elizabeth,Dorothy,Marie,Florence,Mildred Alice,Ethel,Lillian,Gladys,Edna Frances,Rose,Annie,Grace,Bertha Emma,Bessie,Clara,Hazel,Irene Gertrude,Louise,Catherine,Martha,Mabel Pearl,Edith,Esther,Minnie,Myrtle Ida,Josephine,Evelyn,Elsie,Eva Thelma,Ruby,Agnes,Sarah,Viola Nellie,Beatrice,Julia,Laura,Lillie Lucille,Ella,Virginia,Mattie,Pauline Carrie,Alma,Jessie,Mae,Lena Willie,Katherine,Blanche,Hattie,Marion Lucy,Stella,Mamie,Vera,Cora Fannie,Eleanor,Bernice,Jennie,Ann Leona,Beulah,Lula,Rosa,Ada Ellen,Kathryn,Maggie,Doris,Dora Betty,Marguerite,Violet,Lois,Daisy Anne,Sadie,Susie,Nora,Georgia Maude,Marjorie,Opal,Hilda,Velma""".splitlines()) newnames = ','.join("""Emily,Madison,Emma,Hannah,Abigail Olivia,Ashley,Samantha,Alexis,Sarah Elizabeth,Isabella,Alyssa,Grace,Lauren Taylor,Jessica,Brianna,Kayla,Sophia Anna,Natalie,Victoria,Chloe,Sydney Jasmine,Hailey,Megan,Rachel,Morgan Julia,Destiny,Ava,Jennifer,Kaitlyn Mia,Katherine,Alexandra,Haley,Savannah Nicole,Maria,Allison,Mackenzie,Stephanie Brooke,Amanda,Ella,Makayla,Faith Kaylee,Jenna,Andrea,Katelyn,Mary Jordan,Gabrielle,Rebecca,Paige,Madeline Kimberly,Trinity,Zoe,Michelle,Sara Lily,Kylie,Alexa,Caroline,Vanessa Amber,Angelina,Gabriella,Lillian,Riley Sierra,Danielle,Leah,Jada,Autumn Erin,Maya,Ariana,Audrey,Isabel Sofia,Marissa,Bailey,Jacqueline,Melissa Claire,Evelyn,Shelby,Jocelyn,Mariah Avery,Leslie,Melanie,Arianna,Aaliyah""".splitlines()) common = … | |
Re: They are OK, just list of tuples intead of list of tuples. What kind of errror are you getting? Your data must be homogenous to produce a 2d numpy array: http://stackoverflow.com/questions/9534408/numpy-genfromtxt-produces-array-of-what-looks-like-tuples-not-a-2d-arraywhy | |
Re: Maybe the politeness of rule * **Do** provide evidence of having done some work yourself if posting questions from school or work assignments May confuse non-native English speakers. For those maybe the rule should be * **If you expect any kind of help** you better show evidence of having done … | |
Re: print '\n'.join(str(item) for item in a) | |
Re: You inspired me to post this code snippet to Python forum: http://www.daniweb.com/software-development/python/code/432797/brute-force-check-for-largest-palindromic-product-of-three-number-integers | |
![]() | Re: You forgot to put in your code. Do not forget first to push CODE before pasting. |
Re: This would appear clearer way to express your algorithm: abbreviation = raw_input("Abbreviation: ").lower() text = raw_input("Text: ").lower().split() for position in range(len(text) - 2): if all(text[position + ind].startswith(abbreviation[ind]) for ind in range(3)): print ' '.join(text[position:position+3]) | |
Re: You could indent code properly following Python rules and then you can just code taking one step at time and testing/printing the partial results for debugging. | |
Re: You have unterminated string at line 13 and some other syntax errors fix them and also the unnecessary recursion at line 29. YOur code is not fully inside a code block. | |
Re: I would fix it like this: def main(): x = input('Enter a starting value: ') y = input('Enter an ending value: ') # add one to odd starting value and add one to end value to # also get y included for i in range(x + (x & 1), y … |
The End.