Which piece of code will conserve more memory?
I think that code #2 will because I close the file more often, thus freeing
more memory by closing it.
Am I right in this thinking... or does it not save me any more bytes in
memory by closing the file often?
Sure I realize that in my example it doesn
I have a large tar.bz2 file that I want to extract certain files directly to
an FTP path.
Since the extract() method doesn't accept ftp paths... I wanted to read the
files from the tar file like a file object or file I/O stream.
Is there a way to do this?
Here's my pseudocode:
import tarfile
def
ed this other process. How does the timer help
in this? From my experiences with python, python doesn't let anything get in
its way until its done with the current process unless you end it
immediately with ctrl c or pressing X. It won't even let you type text into
the console while it
hon, which is gui of choice for python. I'll settle for a way to
do it via console as well. The overall idea is, is that I want to cut short
the process of a piece of code in order to start another piece of code.
Can you help me with this?
Thanks.
-xbmuncher
if you're on windows, notepad++ has a spell check feature in it using aspell
On Mon, Jun 1, 2009 at 7:50 PM, Alan Gauld wrote:
>
> "Allen Fowler" wrote
>
> Are there any utilities to help "spell check" source code? (Docstrings,
>> etc)
>>
>
> I used to have an emacvs script that could do it fo
5 PM, Alan Gauld wrote:
>
> "xbmuncher" wrote
>
> Traceback (most recent call last):
>> File "C:\path to file\script.py", line 1, in
>>
>> h = open('file2.dat', 'rb')
>> File "C:\Python30\lib\io.py", line
I have a script called: script.py and here are the contents:
h = open('file2.dat', 'rb')
data = h.read(1120)
h.close()
print(data)
input("Press ENTER to exit")
I am editing it in Notepad++ and I set it up so I can run in on python.exe
(I have python30) from the program, it sends these parameter
I ran this in IDLE:
>>> t = 'hi'
>>> print t
SyntaxError: invalid syntax (, line 1)
I've also tried this as sample.py :
import string
text = 'hello world'
print text
It gives me a syntax error on "print text" line
What's going on?
___
Tutor maillist
I've been reading about ways to convert strings and what not to hex and back
and forth. I'm looking for the fastest and least memory intensive way to
search through a file for a hex value and gets its byte offset in the file.
This hex value (that I'm looking for in the file) is of course a hex
repr
On windows XP, I'm running a program that sends TCP connections on port
5039. I'v ran wireshark to determine this. I want to create a simple program
that listens for these connections and intercepts and then turns the data
transferred into a string. From there I'd obviously like my program to act
a
I was reading about urllib2 openers.. Can I make any kind of def or function
and make the urllib2 "urlopen" function run through this function first
before opening a url? For example, something like a reporthook function.
What I want to do is this:
def autoReferer(handle):
if handle.lastRequest.ur
here:
http://www.voidspace.org.uk/python/articles/urllib2.shtml#headers
On Fri, Oct 17, 2008 at 7:29 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 16, 2008 at 11:40 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> > I'm trying to mimic my firefox browser in requesting a webpage wi
I'm trying to mimic my firefox browser in requesting a webpage with python.
Here are the headers obtained by wireshark when I accessed it with firefox:
GET /dirName/ HTTP/1.1
Host: www.website.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3)
Gecko/2008092417 Firefox/3.0.3
on proxy programs:
i want to sniff the http requests that are being made internally from a
program I have no control over, so a proxy server won't work, because I
can't make the program access the internet through a proxy, its not a
browser that is making the requests
Perhaps, you can tell me the
import csv
reader = csv.DictReader(open("test_csv.csv", "r"))
reader is not an actual dictionary from my understanding.. so I don't know
how to access properties like the 'total items' in the dictionary
I want to be able to extract a random dictionary entry from the csv file,
how can I do this by
8 at 7:39 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Sat, Sep 27, 2008 at 11:20 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> > How can I monitor the HTTP connections my windows xp system makes with
> > python?
> >
> > I'm running a program that m
How can I monitor the HTTP connections my windows xp system makes with
python?
I'm running a program that makes requests to websites over HTTP, I know this
by using a program like wireshark. I'd basically like to have a python
program know when this other program makes these requests and be able t
I want to make a program in python that knows the current url of the active
tab in firefox. I want to be able to right click anywhere in my system,
notepad, firefox..etc.. and be able to see an added menu option.
Any pointers on doing this?
Summary of goals:
1. retrieve url of current tab from fir
I tried it just like both of you suggested and sent a req object straight to
urlopen. Here is my code:
import urllib2
url = 'https://url.com'
headers = {
'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
'Accept' :
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
On Mon, Aug 18, 2008 at 8:44 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 18, 2008 at 12:40 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> > I wanted to use the urllib2.https_open() but it said the module did not
> > exist.
>
> I'm not aware of a
I wanted to use the urllib2.https_open() but it said the module did not
exist. The manual says I need SSL support installed. I've done some
searching.. but I haven't been able to find an official implementation of
SSL support for python 2.5 for windows. If its required for urllib2 I assume
its par
Trying to create a program to download RTSP streams. I know that RTSP
streams are live, so its hard to know if the stream will ever end, but the
streams I'm concerned about are fixed length. *I wonder if its possible to
know if the streaming content is fixed length or not *
*Anyways*, I'm wanti
8 at 9:08 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> > I don't see what the big deal is on coming up with the .{ #{, and other
> > bracket types to try to not interfere with normal bracket use in python.
> Its
> > relatively easy to create a parser to identify the br
2008 at 11:39 PM, Chad Crabtree <[EMAIL PROTECTED]> wrote:
> Oh, I forgot there's another way to add braces
>
> if it_is_way_cool: #{
> print 'coolness'
> #}
>
> On Wed, Aug 13, 2008 at 11:06 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> > I
I'll check out your links. But in response to some of the things said:
I'm a fan of indentation, a replacement of indentation with curly braces is
not what I was aiming for. If I could have it my way, I'd have indentation
and curly braces. I don't want to change official python syntax either.. I
ju
Yes I think python is great in its simplicity in typing code but not in its
absence of curly brackets to surround code blocks. Personally, it helps me
visually see the code blocks as well as saves me constant pain when the
compiler complains about broken/missing indents in the code.* I think it
wou
;Accept' :
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'Accept-Language' : 'fr-fr,en-us;q=0.7,en;q=0.3',
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
}
#test it
httpDownload(
I want to download a file via HTTP GET protocol (perhaps HTTP POST in the
future, whatever method should allow relativly easy changes to be made to
use POST later on)
I need to send custom headers like in urllib2.urlrequest()
I need to be able to monitor the download progress WHILE it downloads lik
I want to be able to download bittorrent files with the bittorrent protocol
in my python program using only the native libraries in it. All I am
interested is being able to download & upload simultanaeously, reading parts
that make up the torrent package and being able to choose files/folders to
do
29 matches
Mail list logo