15,181 Topics

Member Avatar for
Member Avatar for TrustyTony

I thought to post some not quite so trivial as it looks quiz for Python, to test if your brain has Python installed OK ;) Try to figure out what interpreter answers (#? lines), then check with your Python interpreter of choice: [CODE]>>> a = list(range(10)) >>> a[1:1] #? >>> …

Member Avatar for TrustyTony
3
658
Member Avatar for Kirielson

Hello, I'm trying to run an object on Python with ROS. When I run the code with a variable inside the object: [CODE]class lk(old_image): ....then some code def main(args): rospy.init_node('lk', anonymous=True) old_image = lk(old_image) try: rospy.spin() except KeyboardInterrupt: print "Shutting down" #cv.DestroyAllWindows() [/CODE] [ICODE]Traceback (most recent call last): File "/home/aadejare/ros/omnisensor/nodes/lk.py", …

Member Avatar for griswolf
0
337
Member Avatar for hszforu

I started learning python3 some 3-4 days ago.My ultimate aim to learn this language is to design web apps(eg apps to automate account creations for seo etc.) For this i guess i will have to use django or turbogears for this, but now i came to know that django or …

Member Avatar for hszforu
0
189
Member Avatar for TrustyTony

There was little buggy version of Python base conversion around, so here quick hack for my own program, including test with random numbers to verify it.

Member Avatar for TrustyTony
0
919
Member Avatar for johanngomes

Hi people, i am in trouble with python quotes, see this: [CODE]string = "qwerty"[/CODE] when i do a print string it returns: [CODE]'qwerty'[/CODE] how do i replace this singles quotes to double quotes when the value of the variable is returned? there is a way? thanks in advance! ;)

Member Avatar for Schol-R-LEA
0
681
Member Avatar for TrustyTony

What modules come builtin with your Python? Let's exclude the internal _ starting ones for this question. You know those? Are you sure? Good, because I did not! (Hint WindowsXP and Python2.72 has 27 builtin modules) Here the answer in code [CODE]import sys print('\n'.join(n for n in sys.builtin_module_names if not …

Member Avatar for Gribouillis
0
301
Member Avatar for Tremillian

I took an intro python class and learned some about jython. Unfortunately, what I have in mind is far too complicated for my level of training. Is it possible to use jython to import pictures from a scanner? If so, what module would I start with/use? The scanner is an …

Member Avatar for FALL3N
0
131
Member Avatar for pblnrao

I created python executable with py2exe. In my program, I use the pywin32 module. [U][B]Details of the SW's[/B][/U] OS Window 7 64 Bit Python 2.6 pywin32-214.win32-py2.6 when i created the exe its working fine on other system running Windows 7 but giving below error when running on Windows XP systems... …

0
133
Member Avatar for andrewtrench

Hi. I have a problem that I am tearing my hair out to solve. I am trying to transfer tens of thousands of records into a sqlite db using the script below. The script seems to run okay and I can see the db growing as it runs to some …

Member Avatar for andrewtrench
0
2K
Member Avatar for vasuv

Hi, I am not aware where to post my query.That's why here I am posting my query.I am sorry for my mistake. Here the requirement is s to write small JYTHON script to modify some parameters on a WebSphere cluster at install time. I am new to this concept. SO …

Member Avatar for griswolf
0
98
Member Avatar for rickyfre

OK geniuses! I have to use python 2.4 and 2.5 here and my programs ideally work with both versions. This area of code was working in 2.4 and 2.5 versions until replacing my computer. Python did not get ported over so I reloaded with new downloads from the web. (both …

Member Avatar for rickyfre
0
396
Member Avatar for darkwing

Hi all. I'm writing a Python program to subscribe to a multicast group and prints out data it receives. The program works fine if the source is in the same subnet as my receiver. However if the source is on a different subnet, my application just doesn't pick it up …

0
74
Member Avatar for 7sisters

Hi, I am really new to Python and I am having real trouble with this new language. This is what I want to do: I have two sets of .txt files that contain numbers. They look like this: FILE1 1028.085 283.795 2056.13 295.254 121912.4 11.346 0.004 147.932 780.677 966.771 289.326 …

Member Avatar for 7sisters
0
160
Member Avatar for debasishgang7

So guys here is my situation. There is text file.Which contains some strings.They are all comma separated. What i wanna do is just read the text file and print individually those strings which are comma separated. Suppose the text file contains: dog,cat,bird,good,bad,blah,blah,blah etc.... The python script should print dog cat …

Member Avatar for vegaseat
0
152
Member Avatar for hszforu

i am using python idle in windows7 to run my program. whenever i try to run the program i get an syntax error as unexpected indent. the code i am trying to run is as follows: [CODE]def print_lol(movies): for each in movies: if isinstance(each,list): print_lol(each) else: print(each)[/CODE]

Member Avatar for Gribouillis
0
922
Member Avatar for vlady

Hello, I do the following exercise: [COLOR="Green"]Write a function called most_frequent that takes a string and prints the letters in decreasing order of frequency. Find text samples from several different languages and see how letter frequency varies between languages. Compare your results with the tables at wikipedia.org/wiki/Letter_frequencies.[/COLOR] I try my …

Member Avatar for vlady
0
998
Member Avatar for Eswarimallur

Hi, I am gettitn error in the python scripts as shown below: AttributeError: 'module' object has no attribute 'lib' I have installed the package WxPython of 2.8 version and Python of version 2.6 Please help me out to resolve this error

Member Avatar for Gribouillis
0
2K
Member Avatar for TrustyTony

Lookup table is usually the fastest method to find function value, if number of values is small. Here we demonstrate the principle by using task of showing the value of byte as binary string or transforming binary string to byte binary value.

0
455
Member Avatar for weezy101

i have a problem with my python class. it contains a method that goes through all the keys of a multi_dimensional dictionary. The dictionary keys may be in the following order (1->(2,3),2->(5,6)). the problem is when the method attempts to get the keys, sometimes it gets them in the right …

Member Avatar for woooee
0
181
Member Avatar for yuvalm2

Is there any good way to share a given directory over the network? Or at least, if the directory is already being shared, is there any way for me to get its network path? (Something like [code]\\190.10.10.1\my_shared_dir\[/code])

Member Avatar for richieking
0
118
Member Avatar for Beat_Slayer

Well, it bothers me to build menus for every shell application that needs one. So, I've written a module to handle that, like in the good old turbo pascal times. :) Here it is, the module comments are pretty explainatory, I think, and the sample usage if run as script …

Member Avatar for Beat_Slayer
0
3K
Member Avatar for techie1991

I was looking around the time module. The time.sleep(no_of_seconds) sleeps the program for no_of_seconds seconds. I don't think this is busy wait. It must be scheduling the process at a later time. Just curious of how this is working.! :)

Member Avatar for techie1991
0
2K
Member Avatar for HuXiaoxiang

Hi all, Forgive my pool English first... I'm learning Python recently. But I met with a problem yesterday and I have liitle experience in solving this kind of problems. Here are the code in Python Shell: [CODE]>>> "HuXiaoxiang\\0Nanjing University\03 Years.".replace("\0"," ") 'HuXiaoxiang\\0Nanjing University\x03 Years.' >>> "HuXiaoxiang \0Nanjing University\03 years.".replace("\0"," ") …

Member Avatar for HuXiaoxiang
0
250
Member Avatar for Michael_Levin

Hello! Is there any method to find out whose machine is handling the file in the network? Using python :) Especially if you haven't administrator's rights (but this is not very important). I don't want to unlock the file, as many programms like Unlocker suggest, only the machine's name :)

0
43
Member Avatar for jordan0420

I am Currently teaching myself PyObjC through tutorials and then modifying them. Now the time has come to open a second nib (addtv) and i cant for the life of me figure it out. [CODE] @objc.IBAction def open_(self, sender): addtv = AddTvControlleralloc().initWithWindowNibName_('addtv') addtv.showWindow_(self) #addtv.retain() [/CODE] What i am attempting to …

0
74
Member Avatar for TrustyTony

As 3.2 has the input bug maybe it makes sense for going with 3.1.4 (I got my computer full of zombie processes with 3.2.1rc and removed it from my WindowsXP machine) [CODE] Python 3.1.4 released Python 3.1.4 has been released. Published: Sun, 12 June 2011 13:00 -0600 [/CODE] Python 2.7 …

Member Avatar for vegaseat
0
221
Member Avatar for Huakalero

In the line 72 of the code i do a findAll to retrieve all 'a' tags that have a 'horariosCarteleraUnderline' class and that have an href url that contains `?ic=[code]&` where code is a common code used to identifie the movie start time. It should retrieve all movie times, but …

Member Avatar for Huakalero
0
221
Member Avatar for jarograv

I have this code: [CODE] def closest(): citiescomp=[] distances=[] for i in range(0,len(city_names)-1): citiescomp.append([city_names[i], citiesx[i], citiesy[i]]) while True: try: targetx=int(raw_input('Please enter the x coordinate of the city you wish to target: ')) if targetx in range(0,1000): break else: print "Oops, it seems like you made a mistake. Try again by …

Member Avatar for Gribouillis
0
106
Member Avatar for katrien202

Hi, I want to put plots using pyplot in a Tkinter window, a frame. I want to have the options I usually have in pyplot figures: the user has to be able to zoom, save,... so a photo of the image will not satisfy. Does anyone now how to do …

Member Avatar for Ene Uran
0
78
Member Avatar for jeffande1966

I am new to Python and encountered an issue while trying to write a script. I am receiving a list index out of range error while trying to read the criminal activity layer file. Any help would be appreciated. Jeff [CODE]import arcpy # Data Layers in Secondary Map Document mxd2 …

Member Avatar for TrustyTony
0
420

The End.