15,190 Topics

Member Avatar for
Member Avatar for Gribouillis

I discovered and installed a firefox addon called Remote Control. This addon starts a telnet server which lets you send javascript commands to the firefox web browser. Combined with python telnetlib module, it becomes very easy to reload or change the content of a tab in a running firefox from …

Member Avatar for Gribouillis
0
924
Member Avatar for kungfubambi

Hi, I'm pretty new to Python. Working in 2.4 due to company restraints. I'm trying to use os.path.walk to work through a tree directory, and perform different actions on the files based on the name of the file. I thought if I used "startwith" it would indicate that files only …

Member Avatar for kungfubambi
0
242
Member Avatar for Daniel200911
Member Avatar for pwolf

Stuck again, this time my problem is getting the dictionary to be sorted in ascending order. Please Advise! the following is what the task says: """ A sparse vector is a vector whose entries are almost all zero, like [1, 0, 0, 0, 0, 0, 0, 2, 0]. Storing all …

Member Avatar for pwolf
0
2K
Member Avatar for FALL3N

I want to run a multiline AppleScript command from a Python script. For a singleline command I can do: [CODE]def stupidtrick(): os.system(cmd) cmd = """osascript -e 'tell app "Finder" to sleep'""" stupidtrick(); [/CODE] however I want to run multiline commands, (such as with multiple 'tell' statements, as in [ICODE]tell application …

0
167
Member Avatar for usdblades

I just started learning python and decided to try and put what I have learned to use in a program and I am having issues with the math I believe. Any suggestions? [CODE] print ("Lets get some utlities information") rent=input("What is your monthly rent: $") pge=input("Estimated PG&E Bill: $") water=input("Estimated …

Member Avatar for usdblades
0
161
Member Avatar for Saqib_J

hi, i'm very new to python. i downloaded pyserial on win7 64bit. using Dell N5010 (it doesn't really have serial port) i tried to open port with ser = serial.Serial(0) but it gave error that [COLOR="red"][Error 2] The system cannot find the file specified.[/COLOR] but with ser = serial.Serial(3) and …

Member Avatar for Saqib_J
0
186
Member Avatar for theweirdone

Hi, I'm trying to extract certain things from a web page. The website is TVRage.com, and the example I'm using at the moment is [URL="http://www.tvrage.com/Warehouse_13/episode_list"]the Warehouse 13 episode list[/URL]. So far I've managed to get the title of the show using this code: [CODE]#!/usr/bin/env python import urllib def save_page(site="http://www.tvrage.com/Warehouse_13/episode_list"): mypath …

Member Avatar for Aung Myat
0
672
Member Avatar for pwolf

Stuck again, still, im learning from my large list of mistakes, haha so this time im trying to convert a decimal to hexadecimal, i tried using hex(number) but its not suitable for the situation as this returns a string. and i dont know how or if i can convert a …

Member Avatar for pwolf
0
2K
Member Avatar for M.S.

I tried many times but no luck. I want to parse a text file with a vcard format (from my phone contacts). the text file looks like this: BEGIN:VCARD VERSION:2.1 REV:20110913T095232Z UID:aac119d5fe3bc9dc-00e17913379d6cc8-3 N;X-EPOCCNTMODELLABEL1=First name:;[B]Maj[/B];;; TEL;VOICE:[B]09120000000[/B] X-CLASS:private END:VCARD BEGIN:VCARD VERSION:2.1 REV:20110228T083215Z UID:aac119d5fe3bc9dc-00e17b0693898c98-4 N;X-EPOCCNTMODELLABEL1=First name:;[B]Ali jahan[/B];;; TEL;VOICE:[B]09120000001[/B] X-CLASS:private END:VCARD BEGIN:VCARD VERSION:2.1 REV:20110228T083510Z …

Member Avatar for snippsat
0
2K
Member Avatar for apeiron27

ok i'm not sure if i can use regex to do this it'd be great if you can give some suggestions! i have a list of pure numbers in one hand and another list of also numbers but with dashes. it's like this: list1 = [245366556346,4534525326562,56345254234237... list2 = [75465-54224-4,3-55-342526,.... as …

Member Avatar for Gribouillis
0
104
Member Avatar for huskeraider

Greetings, I found the equivalent of this in Java but not Python. What i'm trying to figure out is how to reverse and print each of 5 lines in a text file backwards. I am able to take this: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod …

Member Avatar for Thisisnotanid
0
789
Member Avatar for runge_kutta

Hello, I would consider myself a decent python programmer (this may or may not be true). In the past, I have had a few small python contracts and have been screwing around with the language for a few years (I also have experience with c++, java/html/css/javascript/etc). What I would really …

Member Avatar for joehms22
0
200
Member Avatar for Matjame

Hi. I have the below code that update a 'dirpath' and 'cobdate'(calendar) field from a website. When I look at the results from my python script. I can see the correct 'dirpath'. The date value selected is correct(as 2012-01-16) but when it posts or submit, the date comes up incorrectly(20120116) …

Member Avatar for joehms22
0
215
Member Avatar for Xytheron

Hello all, Long time reader, first time poster here. I've been a web programmer for some time now but really never got into any scripting languages, I guess you could say I was just a web designer. Either way I want to write a little web server in Python to …

Member Avatar for joehms22
0
325
Member Avatar for tony75

[B]Hiding .exe file inside JPEG using python3[/B] Hi I would like to hide calc.exe inside the jpg and when I click to my JPEG I would like the calc.exe will execute. My python script do this 1.hide calc.exe file inside jpeg. 2.run calc.exe when I open my jpeg. [B]I will …

Member Avatar for sun_2588
0
235
Member Avatar for Ismatus3

Hello all , I just need to create a folder in an other machine using ssh or samba ; for example i execute : [CODE]os.mkdir( rachid@rachid:/home/rachid/Bureau/new, 0777 ); [/CODE] but It shows the next error : [QUOTE]OSError: [Errno 2] No such file or directory: 'rachid@rachid:/home/rachid/Bureau/new'[/QUOTE] Thank you for answering .

Member Avatar for Ismatus3
0
2K
Member Avatar for funfullson

I am trying to convert a 2d image to 3d one in python. please introduse me some good source or if there is an open source program. Thanks alot.

Member Avatar for funfullson
0
4K
Member Avatar for sainitin

I have text file as follows seq.txt >S1 AACAAGAAGAAAGCCCGCCCGGAAGCAGCTCAATCAGGAGGCTGGGCTGGAATGACAGCG CAGCGGGGCCTGAAACTATTTATATCCCAAAGCTCCTCTCAGATAAACACAAATGACTGC GTTCTGCCTGCACTCGGGCTATTGCGAGGACAGAGAGCTGGTGCTCCATTGGCGTGAAGT CTCCAGGGCCAGAAGGGGCCTTTGTCGCTTCCTCACAAGGCACAAGTTCCCCTTCTGCTT CCCCGAGAAAGGTTTGGTAGGGGTGGTGGTTTAGTGCCTATAGAACAAGGCATTTCGCTT CCTAGACGGTGAAATGAAAGGGAAAAAAAGGACACCTAATCTCCTACAAATGGTCTTTAG TAAAGGAACCGTGTCTAAGCGCTAAGAACTGCGCAAAGTATAAATTATCAGCCGGAACGA GCAAACAGACGGAGTTTTAAAAGATAAATACGCATTTTTTTCCGCCGTAGCTCCCAGGCC AGCATTCCTGTGGGAAGCAAGTGGAAACCCTATAGCGCTCTCGCAGTTAGGAAGGAGGGG TGGGGCTGTCCCTGGATTTCTTCTCGGTCTCTGCAGAGACAATCCAGAGGGAGACAGTGG ATTCACTGCCCCCAATGCTTCTAAAACGGGGAGACAAAACAAAAAAAAACAAACTTCGGG TTACCATCGGGGAACAGGACCGACGCCCAGGGCCACCAGCCCAGATCAAACAGCCCGCGT CTCGGCGCTGCGGCTCAGCCCGACACACTCCCGCGCAAGCGCAGCCGCCCCCCCGCCCCG GGGGCCCGCTGACTACCCCACACAGCCTCCGCCGCGCCCTCGGCGGGCTCAGGTGGCTGC GACGCGCTCCGGCCCAGGTGGCGGCCGGCCGCCCAGCCTCCCCGCCTGCTGGCGGGAGAA ACCATCTCCTCTGGCGGGGGTAGGGGCGGAGCTGGCGTCCGCCCACACCGGAAGAGGAAG TCTAAGCGCCGGAAGTGGTGGGCATTCTGGGTAACGAGCTATTTACTTCCTGCGGGTGCA CAGGCTGTGGTCGTCTATCTCCCTGTTGTTC >S2 ACACGCATTCACTAAACATATTTACTATGTGCCAGGCACTGTTCTCAGTGCTGGGGATAT AGCAGTGAAGAAACAGAAACCCTTGCACTCACTGAGCTCATATCTTAGGGTGAGAAACAG TTATTAAGCAAGATCAGGATGGAAAACAGATGGTACGGTAGTGTGAAATGCTAAAGAGAA AAATAACTACGGAAAAGGGATAGGAAGTGTGTGTATCGCAGTTGACTTATTTGTTCGCGT TGTTTACCTGCGTTCTGTCTGCATCTCCCACTAAACTGTAAGCTCTACATCTCCCATCTG TCTTATTTACCAATGCCAACCGGGGCTCAGCGCAGCGCCTGACACACAGCAGGCAGCTGA CAGACAGGTGTTGAGCAAGGAGCAAAGGCGCATCTTCATTGCTCTGTCCTTGCTTCTAGG AGGCGAATTGGGAAATCCAGAGGGAAAGGAAAAGCGAGGAAAGTGGCTCGCTTTTGGCGC TGGGGAAGAGGTGTACAGTGAGCAGTCACGCTCAGAGCTGGCTTGGGGGACACTCTCACG CTCAGGAGAGGGACAGAGCGACAGAGGCGCTCGCAGCAGCGCGCTGTACAGGTGCAACAG CTTAGGCATTTCTATCCCTATTTTTACAGCGAGGGACACTGGGCCTCAGAAAGGGAAGTG CCTTCCCAAGCTCCAACTGCTCATAAGCAGTCAACCTTGTCTAAGTCCAGGTCTGAAGTC CTGGAGCGATTCTCCACCCACCACGACCACTCACCTACTCGCCTGCGCTTCACCTCACGT GAGGATTTTCCAGGTTCCTCCCAGTCTCTGGGTAGGCGGGGAGCGCTTAGCAGGTATCAC CTATAAGAAAATGAGAATGGGTTGGGGGCCGGTGCAAGACAAGAATATCCTGACTGTGAT TGGTTGAATTGGCTGCCATTCCCAAAACGAGCTTTGGCGCCCGGTCTCATTCGTTCCCAG CAGGCCCTGCGCGCGGCAACATGGCGGGGTCCAGGTGGAGGTCTTGAGGCTATCAGATCG GTATGGCATTGGCGTCCGGGCCCGCAAGGCG . . . . I …

Member Avatar for TrustyTony
0
290
Member Avatar for Zeref

So i was busy playing around with the python module MySQLdb and looking at sql injection. [CODE] import MySQLdb def hack(name): db=MySQLdb.connect('xxx','xxx','xxx','xxx') cursor=db.cursor() sql="SELECT * FROM PLAYERS WHERE NAME = %s" %(name) print sql cursor.execute(sql) print cursor.fetchall() [/CODE] i entered Hack("'pete' OR '1'='1'") results were: SELECT * FROM PLAYERS WHERE …

Member Avatar for woooee
0
282
Member Avatar for colejmc20

1. (10 points) Using string method find, extract the Video link from the following HTML code for embedding videos on a web page. Your code should work for any embedded code of this format. <embed src="http://www.youtube.com/v/Xp2uzv9uSn8?version=3&feature=pl ayer_detailpage" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"> 2. (10 points) In the Disney cartoon adaptation …

Member Avatar for woooee
0
165
Member Avatar for Irina77

Please give me ideas why would I get following errors: [code] Traceback (most recent call last): File "C:\temp_Jag\FilePickling.py", line 3, in <module> unpickledlist = pickle.load(unpicklefile) File "C:\Python26\lib\pickle.py", line 1370, in load return Unpickler(file).load() File "C:\Python26\lib\pickle.py", line 858, in load dispatch[key](self) File "C:\Python26\lib\pickle.py", line 1142, in load_pop_mark k = self.marker() File …

Member Avatar for Irina77
0
190
Member Avatar for jola.chmiel

Hi, I am just begining my adventure(if i may call it this way) with python used for web development. I found out that there are two well known frameworks: django and pylons. I read about them a lot, but I am not certain which one to pick. That's why I …

Member Avatar for sun_2588
0
108
Member Avatar for sun_2588

Hello everyone , i am trying to write a python code which will setup user quota for a user home directory...... i am successful in completing all the basic configuration, like entry in fstab file running quotacheck command.... The only issue which i am facing is of edquota command .... …

0
65
Member Avatar for Tcll

first off... a litte explanation as to what I'm doing... this is basically a way for me to create an update system for my program... the webhost I'm using allows hot-file linkage, so there's nothing that's improper... (except for my compy not having net) anyways... the structure I have for …

Member Avatar for Tcll
0
166
Member Avatar for Gribouillis

These two functions compute the orders of the lowest bit and the highest bit set in the binary representation of an integer. I expect them to handle securely very large integer values.

Member Avatar for Gribouillis
1
2K
Member Avatar for spyhawk

I am new to python i am trying to return True if the strs are the same (including lettercase), and False otherwise. def abc(str, str): x = raw_input() y = raw_input() return x==y i have no idea how to compare two strings, is there code for getting how many letters …

Member Avatar for woooee
0
159
Member Avatar for imperfectluck1

k I'm trying to create a program that calculates the Standard deviation of a sample of r random numbers between 0 and 1 in python 2.7. This is my program: [CODE] from random import random r= input("please enter a number r: ") for i in range(r): sum1=0 i = random() …

Member Avatar for woooee
0
154
Member Avatar for ronvenna

Hello I am supposed to find a bunch of different statistics from a text file for a homework assignment. I have found everything except the shortest line that is not a blank line. Can someone help me solve this problem? Thanks [CODE] def stats(): linecount = 0 blankline = 0 …

Member Avatar for woooee
0
531
Member Avatar for Noliving

Hello everyone, I'm obviously having trouble with a program that wants me to create a house with just five mouse clicks. My program is simple create a house using only 5 mouse clicks. This problem is from the book Python Programming by John Zelle Its on page 162 This is …

Member Avatar for Karsam
-1
4K

The End.