On 9/23/12 8:45 AM, Kevin Walzer wrote:
There's nothing to do here; it's an aspect of the native dialog.
To clarify: there's nothing to do at the C level, which is where the
native dialog is invoked. IDLE can probably be patched to accept other
file types, such as "dat."
--
Kevin Walzer
Cod
On 9/23/12 3:33 AM, Ned Deily wrote:
This appears to a difference in behavior between Carbon Tk 8.4 and Cocoa
Tk 8.5 on OS X. The python.org 32-bit-only installers are built to link
with the former and, with 8.4, the Open file dialog box does have the
file-type filter menu as Hans describes. Th
In article <505d9cc5$0$6846$e4fe5...@news2.news.xs4all.nl>,
Hans Mulder wrote:
> On 22/09/12 09:30:57, Franck Ditter wrote:
> > In article <505ccdc5$0$6919$e4fe5...@news2.news.xs4all.nl>,
> > Hans Mulder wrote:
> >> On 21/09/12 16:29:55, Franck Ditter wrote:
> >>> I create a text file utf-8 enc
On 22/09/12 09:30:57, Franck Ditter wrote:
> In article <505ccdc5$0$6919$e4fe5...@news2.news.xs4all.nl>,
> Hans Mulder wrote:
>
>> On 21/09/12 16:29:55, Franck Ditter wrote:
>>> I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion).
>>> It runs fine and creates the disk file, visib
In article <505ccdc5$0$6919$e4fe5...@news2.news.xs4all.nl>,
Hans Mulder wrote:
> On 21/09/12 16:29:55, Franck Ditter wrote:
> > I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion).
> > It runs fine and creates the disk file, visible with
> > TextWrangler or another.
> > But I can
On 21/09/12 16:29:55, Franck Ditter wrote:
> I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion).
> It runs fine and creates the disk file, visible with
> TextWrangler or another.
> But I can't open it with IDLE (its name is greyed).
> IDLE is supposed to read utf-8 files, no ?
> Th
On Sat, Oct 15, 2011 at 8:18 PM, MrPink wrote:
> I did not understand what a tuple was.
> So it was very hard for me to understand what a namedtuple was and
> follow the code.
> Then I looked up the word at dictionary.com and got this:
> http://dictionary.reference.com/browse/tuple
>
> tuple: com
I did not understand what a tuple was.
So it was very hard for me to understand what a namedtuple was and
follow the code.
Then I looked up the word at dictionary.com and got this:
http://dictionary.reference.com/browse/tuple
tuple: computing a row of values in a relational database
Now I under
Chris,
Thanks for the help.
I am using the powerball numbers from this text file downloaded from the site.
http://www.powerball.com/powerball/winnums-text.txt
The first row is the header/fieldnames and the file starts off like this:
Draw Date WB1 WB2 WB3 WB4 WB5 PB PP
10/12/2011 43 10 12 23
On Fri, Oct 14, 2011 at 7:59 PM, MrPink wrote:
> This is what I have been able to accomplish:
>
> def isInt(s):
> try:
> i = int(s)
> return True
> except ValueError:
> return False
>
> f = open("powerball.txt", "r")
> lines = f.readlines()
> f.close()
>
> dDrawings = {}
On Sat, Oct 15, 2011 at 1:59 PM, MrPink wrote:
> def isInt(s):
> try:
> i = int(s)
> return True
> except ValueError:
> return False
>
> f = open("powerball.txt", "r")
> lines = f.readlines()
> f.close()
>
> dDrawings = {}
> for line in lines:
> if isInt(line[0]):
>
This is what I have been able to accomplish:
def isInt(s):
try:
i = int(s)
return True
except ValueError:
return False
f = open("powerball.txt", "r")
lines = f.readlines()
f.close()
dDrawings = {}
for line in lines:
if isInt(line[0]):
t = line.split()
On Oct 13, 10:59 pm, MrPink wrote:
> This is a continuing to a post I made in
> August:http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> I got some free time to work with Python again and have some followup
> questions.
>
> For example, I have a list in a text file like
On Thu, Oct 13, 2011 at 3:59 PM, MrPink wrote:
> This is a continuing to a post I made in August:
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gst&q=MrPink#ce6d4d09911e4107
>
> I got some free time to work with Python again and have s
Ouray Viney wrote:
> Hi:
>
> Problem:
> =
> I want to read a ASCII text file that can have data appended to it. I
> have hacked some code together that handles the basics, but it falls
> short. My code doesn't read in the new lines that could have been
> added to the end of the file. No
Ouray Viney wrote:
Hi:
Problem:
=
I want to read a ASCII text file that can have data appended to it. I
have hacked some code together that handles the basics, but it falls
short. My code doesn't read in the new lines that could have been
added to the end of the file. Not python's fau
On Dec 1, 3:09 pm, Ouray Viney wrote:
> Problem:
> =
> I want to read a ASCII text file that can have data appended to it.
>
> Example scenario: As the python script is running a user/application
> adds new entries to the end of the test case file, example, adds the
> following to the fi
On Mar 6, 1:28 am, MRAB wrote:
> Aahz wrote:
> > In article ,
> > Terry Reedy wrote:
> >> for line in open('char.txt'):
> >> if line.find('sweet') != -1 or line.find('blue') != -1:
> >> print(line)
>
> > For any recent Python, this should be:
>
> > if 'sweet' in line or 'blue' in line:
Aahz wrote:
In article ,
Terry Reedy wrote:
for line in open('char.txt'):
if line.find('sweet') != -1 or line.find('blue') != -1:
print(line)
For any recent Python, this should be:
if 'sweet' in line or 'blue' in line:
Although I think that for the OP's use case, it ought to be:
In article ,
Terry Reedy wrote:
>
>for line in open('char.txt'):
> if line.find('sweet') != -1 or line.find('blue') != -1:
> print(line)
For any recent Python, this should be:
if 'sweet' in line or 'blue' in line:
Although I think that for the OP's use case, it ought to be:
if l
On Feb 15, 10:27 am, Steven D'Aprano wrote:
> Philipp Pagel wrote:
> > zaheer.ag...@gmail.com wrote:
> >> Hi
>
> >> How do i read a file in Python and search a particular pattern
> >> like I have a file char.txt which has
>
> >> Mango=sweet
> >> Sky=blue
>
> >> I want to get the strings sweet an
Philipp Pagel wrote:
> zaheer.ag...@gmail.com wrote:
>> Hi
>
>> How do i read a file in Python and search a particular pattern
>> like I have a file char.txt which has
>
>> Mango=sweet
>> Sky=blue
>
>> I want to get the strings sweet and blue,How to do this..?
>
> If your entire file consist
zaheer.ag...@gmail.com wrote:
> Hi
> How do i read a file in Python and search a particular pattern
> like I have a file char.txt which has
> Mango=sweet
> Sky=blue
> I want to get the strings sweet and blue,How to do this..?
If your entire file consists of such key=value pairs you may want t
zaheer.ag...@gmail.com wrote:
Hi
How do i read a file in Python and search a particular pattern
like I have a file char.txt which has
Mango=sweet
Sky=blue
I want to get the strings sweet and blue,How to do this..?
for line in open('char.txt'):
if line.find('sweet') != -1 or line.find('bl
aditya shukla wrote:
I have a text file whose contents are like this:-
jd|fj|dnv|jd|0.33|c:\\windows\\win32
shcbsbs|nscsjsj|0.93|hsbcjsnc
I am trying to read the file like this:-
>>> x = open("c:\\a.txt","r")
Better to use "rb" (for binary read) rather than "r" mode.
>>> x.read()
Now, te
aditya shukla wrote:
I have a text file whose contents are like this:-
jd|fj|dnv|jd|0.33|c:\\windows\\win32
shcbsbs|nscsjsj|0.93|hsbcjsnc
I am trying to read the file like this:-
>>> x = open("c:\\a.txt","r")
>>> x.read()
eh, wouldn't it be easier if you actually read the replies to your
"Karim Ali" wrote:
> Hi,
>
> Simple question. Is it possible in python to write code of the type:
>
> -
> while not eof <- really want the EOF and not just an empty line!
readline() reads to the next newline - an empty line *is* EOF -
a blank line has at least a
Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
>If you open the file in binary mode, you can easily keep track of the
>position in file:
>
>bytepos = 0
>with file(filename) as f:
> for line in f:
> ... process line ...
> bytepos += len(line)
>
>If you need to restart the operation, simply seek
"Karim Ali" <[EMAIL PROTECTED]> writes:
> -
> while not eof <- really want the EOF and not just an empty line!
> readline by line
> end while;
> -
for line in open_file:
...
It will stop on EOF, not on empty line.
> But also, in cas
Karim Ali wrote:
> Hi,
>
> Simple question. Is it possible in python to write code of the type:
>
> -
> while not eof <- really want the EOF and not just an empty line!
> readline by line
> end while;
> -
>
> What I am using now is the im
In <[EMAIL PROTECTED]>, Karim Ali
wrote:
> Simple question. Is it possible in python to write code of the type:
>
> -
> while not eof <- really want the EOF and not just an empty line!
> readline by line
> end while;
> -
while True:
Thanks very much all for respondingI got it working. As you
indicated, I just had mixed up my escapes (//) with my \n. When I got
the correct amount of backslashes and removed the linefeeds it worked
great.
Thanks again.
--
http://mail.python.org/mailman/listinfo/python-list
You should use os.path.exists to test if a file exists. Your
exception-catching structure is not necessary.
Also, if the file you are reading from contains proper Windows
filenames, it is not necessary to replace \ with \\ and so forth. The
\ acts as an escape character only when it is in Python
[EMAIL PROTECTED] wrote:
> I have the simplest need...to read a file full of file names(unc) and
> then check to see if each of these files exists. I tried with the
> following program, but always get file not found, even when it is
> there. If I type in the file name as a literal it works...
>
>
Answer to a similar question:
http://groups.google.com/group/comp.lang.python/msg/c01f292d7926f393?hl=en&;
If you want a way that will work regardless if your module is run
interactively, imported, or just run by itself, this is a solution that
will always work:
:: \wherever\wherever\ (the d
On 17 Nov 2005 17:29:55 -0800, [EMAIL PROTECTED] wrote:
>I'm trying to read an XML file in the same directory as my python code,
>using minidom:
>
>document = xml.dom.minidom.parse("data.xml")
>
>How can I read in the file "data.xml" without knowing it's full
>path--just that it's in the same dire
36 matches
Mail list logo