Steve Hayes writes:
> So if I want to run it on another computer, where do I look for the
> compiled executable program to copy?
You generally don't do that (the compiled files tend to be specific to
various aspects of the target platform). This is a way that i's
important to remember that most
On Mon, 10 Nov 2014 16:12:07 +1100, Ben Finney
wrote:
>Steve Hayes writes:
>
>> I have a book on Python that advocates dividing programs into modules,
>> and importing them when needed.
>
>Which book is this? (This is not essential to your question, but it
>might help to gauge your broader learn
Steve Hayes writes:
> I have a book on Python that advocates dividing programs into modules,
> and importing them when needed.
Which book is this? (This is not essential to your question, but it
might help to gauge your broader learning environment.)
> I can understand doing that in a compiled
On 10/11/14 14:55, Steve Hayes wrote:
I have a book on Python that advocates dividing programs into modules, and
importing them when needed.
I have a question about this.
I can understand doing that in a compiled language, where different modules
can be imported from all sorts of places when th
I have a book on Python that advocates dividing programs into modules, and
importing them when needed.
I have a question about this.
I can understand doing that in a compiled language, where different modules
can be imported from all sorts of places when the program is compiled.
But I understa
Albert,
Code is not removing empty lines containing blank characters and not removing
leading and trailing spaces present in each line.
import glob, codecs, re, os
regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
for txt in glob.glob("D:/Python/source/*.txt"):
with codecs.o
Let's have some fun nutting out possible implementations for a bad idea :)
If you want a dictionary that prepopulates itself on demand, you
implement __missing__. Is there a way to implement the same thing for
the __main__ module? Since it isn't imported (as such), I don't think
"switch out what's
On Sun, Nov 9, 2014 10:51 PM CET Syed Khalid wrote:
>Albert,
>
>Thanks a million for script,
>
>It worked fine after I closed the bracket.
>
>
>import glob, codecs, re, os
>
>regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
>
>for txt in glob.glob("D:/Python/s
Albert,
Thanks a million for script,
It worked fine after I closed the bracket.
import glob, codecs, re, os
regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
for txt in glob.glob("D:/Python/source/*.txt"):
with codecs.open(txt, encoding="utf-8") as f:
oldlines = f.readlines
On 2014-11-09 21:20, Syed Khalid wrote:
Code after adding path of .txt files :
import glob, codecs, re, os
regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
for txt in glob.glob("D:/Python/source/*.txt"):
with codecs.open(txt, encoding="utf-8") as f:
oldlines = f.readlines
Code after adding path of .txt files :
import glob, codecs, re, os
regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
for txt in glob.glob("D:/Python/source/*.txt"):
with codecs.open(txt, encoding="utf-8") as f:
oldlines = f.readlines()
for i, line in enumerate(oldlines):
My Script,
I have added
import glob, codecs, re, os
regex = re.compile(r"Age: |Sex: |House No: ") # etc etc
Script I executed in EditRocket :
for txt in glob.glob("/D:/Python/source/*.txt"):
with codecs.open(txt, encoding="utf-8") as f:
oldlines = f.readlines()
for i, line
Hi Albert,
Thank you for script.
I am getting the below error :
File "EamClean.log", line 12
with codecs.open(txt + "_out.txt", "wb", encoding="utf-8") as w:
^
SyntaxError: invalid syntax
Kindly do the needful.
On Mon, Nov 10, 2014 at 1:53 AM, Albert-Jan Roskam wrote:
>
>
>
>
>
- Original Message -
> From: Syed Khalid
> To: python-list@python.org
> Cc:
> Sent: Sunday, November 9, 2014 8:58 PM
> Subject: Python script that does batch find and replace in txt files
>
> Python script that does batch find and replace in txt files Need a python
> script
> that
On 09/11/2014 19:58, Syed Khalid wrote:
Python script that does batch find and replace in txt files Need a python
script that opens all .txt files in a folder find replace/delete text and save
files.
I have text files and I need to perform below steps for each file.
Step 1: Put cursor at star
On 11/09/2014 03:38 AM, Gregory Ewing wrote:
Ethan Furman wrote:
And the thing going on is the normal python behavior (in __getattribute__, I
believe) of examining the returned
attribute to see if it is a descriptor, and if so invoking it.
Only if you look it up through the instance, though.
Python script that does batch find and replace in txt files Need a python
script that opens all .txt files in a folder find replace/delete text and save
files.
I have text files and I need to perform below steps for each file.
Step 1: Put cursor at start of file and Search for "Contact's Name:
On Sun, Nov 9, 2014 at 12:46 PM, Terry Reedy wrote:
> On 11/9/2014 6:11 AM, satishmlm...@gmail.com wrote:
>>
>> What is rstrip() in python?
google on 'rstrip python' gets this at first link:
https://docs.python.org/2/library/stdtypes.html#str.rstrip
google is your friend.
>
>
> The manuals have
On 11/9/2014 6:11 AM, satishmlm...@gmail.com wrote:
What is rstrip() in python?
The manuals have a rather complete index. If 'rstrip' is missing from
the index, let us know so we can fix it.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Nov 9, 2014 at 2:06 AM, Veek M wrote:
> https://docs.python.org/3.4/library/functools.html
>
> 1. "A key function is a callable that accepts one argument and returns
> another value indicating the position in the desired collation sequence."
>
> x = ['x','z','q']; sort(key=str.upper)
This
Yusuf Can Bayrak wrote:
> when dictionary has one value for each key it's okey. I'm just type '%
> greek_letters' and it's working.
>
> But how can i assign dict's values to formatted print, if it has more
> values than one.
>
>>
>>1. # -*- coding: utf-8 -*-
>>2. greek_letters = {
>>
On 09/11/2014 11:11, satishmlm...@gmail.com wrote:
What is rstrip() in python?
It's a function or method call.
What does it do in the following piece of code?
I'm not actually sure. Would you be kind enough to look it up in the
documentation for me and let me know, thanks?
import sql
On 09/11/2014 11:05, satishmlm...@gmail.com wrote:
curs is coming from the following piece of code
import sqlite3
conn = sqlite3.connect('dbase1')
curs = conn.cursor()
Today's exercise is to find the documentation and read it before posting
another question. Better still is to use the inter
Yusuf Can Bayrak Wrote in message:
> when dictionary has one value for each key it's okey. I'm just type '%
> greek_letters' and it's working.
>
> But how can i assign dict's values to formatted print, if it has more values
> than one. # -*- coding: utf-8 -*-greek_letters = {
Gregory Ewing wrote:
> Ethan Furman wrote:
>> And the thing going on is the normal python behavior (in
>> __getattribute__, I believe) of examining the returned attribute to see
>> if it is a descriptor, and if so invoking it.
>
> Only if you look it up through the instance, though.
> Normally, i
satishmlm...@gmail.com wrote:
> What is rstrip() in python?
Have you read the Fine Manual?
Did you try googling first?
https://duckduckgo.com/html/?q=python+rstrip
> What does it do in the following piece of code?
It removes trailing whitespace.
> import sqlite3
> conn = sqlite3.connect('d
Tobiah wrote:
> I decided I'd like to publish some youtube videos of me playing
> an instrument. The audio being the important bit, I'd like to use
> my existing mics, which I've been sending through a USB audio interface
> to my computer.
>
> I don't have any camera yet, other than a prosumer
On 2014-11-09 02:42, satishmlm...@gmail.com wrote:
> What does description attribute in the following code mean?
>
> curs.execute('select * from people')
> colnames = [desc[0] for desc in curs.description]
http://legacy.python.org/dev/peps/pep-0249/#cursor-attributes
-tkc
--
https://mail.py
Not fans of videos hey(well python videos anyway) bugger.
Sayth.
--
https://mail.python.org/mailman/listinfo/python-list
Ethan Furman wrote:
And the thing going on is the normal python behavior (in
__getattribute__, I believe) of examining the returned attribute to see
if it is a descriptor, and if so invoking it.
Only if you look it up through the instance, though.
Normally, if you look up an attribute on a cla
On Sun, Nov 9, 2014 at 10:11 PM, wrote:
> What is rstrip() in python?
>
> What does it do in the following piece of code?
>
> import sqlite3
> conn = sqlite3.connect('dbase1')
> curs = conn.cursor()
>
> file = open('data.txt')
> rows = [line.rstrip().split(',') for line in file]
Do you know what
What is rstrip() in python?
What does it do in the following piece of code?
import sqlite3
conn = sqlite3.connect('dbase1')
curs = conn.cursor()
file = open('data.txt')
rows = [line.rstrip().split(',') for line in file]
--
https://mail.python.org/mailman/listinfo/python-list
On 09/11/14 20:59, Steven D'Aprano wrote:
It's an attribute called "description". You would need to read the
documentation for curs to know what it does.
What is curs? Where does it come from?
It looks like a cursor from an SQL DB library.
For example, sqlite3 in the standard library provides
curs is coming from the following piece of code
import sqlite3
conn = sqlite3.connect('dbase1')
curs = conn.cursor()
--
https://mail.python.org/mailman/listinfo/python-list
sorry my bad
On Sun, Nov 9, 2014 at 7:58 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> satishmlm...@gmail.com wrote:
>
> > What does zip return in the following piece of code?
>
> Have you read the Fine Manual?
>
> In Python 2, zip returns a list:
>
> zip(['a', 'b', 'c'], [
satishmlm...@gmail.com wrote:
> What does zip return in the following piece of code?
Have you read the Fine Manual?
In Python 2, zip returns a list:
zip(['a', 'b', 'c'], [1, 2, 3])
=> [('a', 1), ('b', 2), ('c', 3)]
https://docs.python.org/2/library/functions.html#zip
In Python 3, zip does t
satishmlm...@gmail.com wrote:
> What does description attribute in the following code mean?
>
> curs.execute('select * from people')
> colnames = [desc[0] for desc in curs.description]
It's an attribute called "description". You would need to read the
documentation for curs to know what it does.
What does zip return in the following piece of code?
curs.execute('select * from people')
colnames = [desc[0] for desc in curs.description]
rowdicts = []
for row in curs.fetchall():
rowdicts.append(dict(zip(colnames, row)))
--
https://mail.python.org/mailman/listinfo/python-list
What does description attribute in the following code mean?
curs.execute('select * from people')
colnames = [desc[0] for desc in curs.description]
--
https://mail.python.org/mailman/listinfo/python-list
when dictionary has one value for each key it's okey. I'm just type '%
greek_letters' and it's working.
But how can i assign dict's values to formatted print, if it has more
values than one.
>
>1. # -*- coding: utf-8 -*-
>2. greek_letters = {
>3. 'omega': ['ω','Ω']
https://docs.python.org/3.4/library/functools.html
1. "A key function is a callable that accepts one argument and returns
another value indicating the position in the desired collation sequence."
x = ['x','z','q']; sort(key=str.upper)
My understanding is that, x, y, .. are passed to the key fun
Ned Batchelder wrote:
> On 11/7/14 9:52 AM, Veek M wrote:
> and you want to end up on the "def" token, not the "def" in
yep, bumped into this :) thanks!
--
https://mail.python.org/mailman/listinfo/python-list
42 matches
Mail list logo