On 03/15/2013 01:53 AM, Paradox wrote:
There is something I can't figure out about the following code (using
python 2.7.3):
def return_tree_files(rootpath, pattern):
for root, dirs, files in os.walk(rootpath):
i = [os.path.join(root, filename) for filename in
fnmatch.filter(files,
There is something I can't figure out about the following code (using python
2.7.3):
def return_tree_files(rootpath, pattern):
for root, dirs, files in os.walk(rootpath):
i = [os.path.join(root, filename) for filename in fnmatch.filter(files,
pattern)]
return i
I thought th
Hello Alan,
Thank you for your feedback. I will break it down in the order that I
had stated in my quick steps, work on each pice getting one part work
at a time build like lays (smile)
Thank You, will post as I do to get advise on improvements or corrections.
Sincerely in Christ,
Christopher
On 03/14/2013 07:23 PM, Matthew Ngaha wrote:
if Enemy.ships:
for missile in self.missiles:
flag = False
for rect in Enemy.rects:
assert(!flag)
if QPoint(miss
On 14/03/13 21:25, Christopher Emery wrote:
Okay, I know the best way to learn how to do something is to jump in so
I have decided I would like to make a program (command line) to get
files from a website that will be then used later on by another program.
OK, thats a good place to start.
Next
On 03/14/2013 08:45 PM, Matthew Ngaha wrote:
thanks guys ive finally got it working. even though i didnt use the
flag due to invalid syntax i realized since i was getting no errors i
wasnt actually doing anything wrong. My mistake was i removed the
ememy ship but for some reason forgot to remove
thanks guys ive finally got it working. even though i didnt use the
flag due to invalid syntax i realized since i was getting no errors i
wasnt actually doing anything wrong. My mistake was i removed the
ememy ship but for some reason forgot to remove the missile so it was
still active on the next
On 03/14/2013 08:08 PM, Matthew Ngaha wrote:
One good approach is to have a separate function or method with
>> both loops:
>>
>> def attack(self, Enemy):
>>
>> for missile in self.missiles:
>> for rect in Enemy.rects:
>> if QPoint(missile.x + 5, missile.y) in rect:
>> explosion = Explosion(rec
> One good approach is to have a separate function or method with
> both loops:
>
> def attack(self, Enemy):
>
> for missile in self.missiles:
> for rect in Enemy.rects:
> if QPoint(missile.x + 5, missile.y) in rect:
> explosion = Explosion(rect.x(), rect.y()
>> if Enemy.ships:
>> for missile in self.missiles:
>
>flag = False
>>
>> for rect in Enemy.rects:
>
>assert(!flag)
>
>> if QPoint(missile.x + 5, missile.y) in rect:
>>
On 03/14/2013 06:38 PM, Matthew Ngaha wrote:
i cant seem to break out of this loop. let me explain the variables you see:
if Enemy.ships:
for missile in self.missiles:
flag = False
for rect in Enemy.rects:
On 03/14/2013 06:38 PM, Matthew Ngaha wrote:
i cant seem to break out of this loop. let me explain the variables you see:
>
> Enemy.ships = [] #an Enemy class variable that contains enemy ships
> self.missiles = [] an instance variable that appends how many Visible
> missiles my ship has fired
On 03/14/2013 02:22 PM, Irina I wrote:
Hi all,
I'm new to Python and am trying to pass a config file to my Python script. The
config file is so simple and has only two URLs.
The code should takes that configuration file as input and generates a single
file in HTML format as output.
The progr
i cant seem to break out of this loop. let me explain the variables you see:
Enemy.ships = [] #an Enemy class variable that contains enemy ships
self.missiles = [] an instance variable that appends how many Visible
missiles my ship has fired
Enemy.rects = [] an Enemy class variable that represents
Hello All,
Okay, I know the best way to learn how to do something is to jump in so I
have decided I would like to make a program (command line) to get files
from a website that will be then used later on by another program.
Program idea - quick steps to do
***
file-fetcher (within zip file)
get
Irina I
> Hi all,
>
> I'm new to Python and am trying to pass a config file to my Python script.
> The config file is so
> simple and has only two URLs.
>
> The code should takes that configuration file as input and generates a single
> file in HTML format as
> output.
>
> The program must ret
Hi all,
I'm new to Python and am trying to pass a config file to my Python script. The
config file is so simple and has only two URLs.
The code should takes that configuration file as input and generates a single
file in HTML format as output.
The program must retrieve each web page in the lis
Spyros Charonis wrote:
> Hello Pythoners,
>
> I am trying to extract certain fields from a file that whose text looks like
> this:
>
> COMPND 2 MOLECULE: POTASSIUM CHANNEL SUBFAMILY K MEMBER 4;
> COMPND 3 CHAIN: A, B;
>
> COMPND 10 MOL_ID: 2;
> COMPND 11 MOLECULE: ANTIBODY FAB FRAGMENT LI
Yes, the elif line need to have **flag_FAB ==1** as is conidition instead
of **flag_FAB=1**. So:
for line in scanfile:
if line[0:6]=='COMPND' and 'FAB' in line: flag_FAB = 1
elif line[0:6]=='COMPND' and 'CHAIN' in line and flag_FAB == 1:
print line
flag_FAB = 0
On Th
On 14/03/2013 11:28, taserian wrote:
Top posting fixed
On Thu, Mar 14, 2013 at 6:56 AM, Spyros Charonis mailto:s.charo...@gmail.com>> wrote:
Hello Pythoners,
I am trying to extract certain fields from a file that whose text
looks like this:
COMPND 2 MOLECULE: POTASSIUM CHA
On 03/14/2013 07:28 AM, taserian wrote:
Since the identifier and the item that you want to keep are on different lines, you'll need to set
a "flag".
>
> with open(filename) as file:
>
> scanfile=file.readlines()
>
> flag = 0
>
> for line in scanfile:
>
> if line[0:6]=='COMPND' and 'FAB FRAGMENT
On Thu, 14 Mar 2013, Steven D'Aprano wrote:
If you have some unknown, arbitrary iterable that doesn't support len(),
then you can use the sum() trick:
it = some_unknown_iterable()
sum(1 for x in it)
Yes, of course you are correct. This was my intention, but I chose an
especially poorly contri
On 14/03/13 10:30, David Bradshaw wrote:
I have written some code that logs into a list of hosts and runs a
couple of commands to find out some information. Which I then save to a
file and process.
A cut down version of the information I generate and save can be found
here - http://pastebin.com/
On 14 March 2013 10:56, Spyros Charonis wrote:
> Hello Pythoners,
>
> I am trying to extract certain fields from a file that whose text looks like
> this:
>
> COMPND 2 MOLECULE: POTASSIUM CHANNEL SUBFAMILY K MEMBER 4;
> COMPND 3 CHAIN: A, B;
> COMPND 10 MOL_ID: 2;
> COMPND 11 MOLECULE: ANTIB
Since the identifier and the item that you want to keep are on different
lines, you'll need to set a "flag".
with open(filename) as file:
scanfile=file.readlines()
flag = 0
for line in scanfile:
if line[0:6]=='COMPND' and 'FAB FRAGMENT' in line: flag = 1
elif line[
Hello Pythoners,
I am trying to extract certain fields from a file that whose text looks
like this:
COMPND 2 MOLECULE: POTASSIUM CHANNEL SUBFAMILY K MEMBER 4;
COMPND 3 CHAIN: A, B;
COMPND 10 MOL_ID: 2;
COMPND 11 MOLECULE: ANTIBODY FAB FRAGMENT LIGHT CHAIN;
COMPND 12 CHAIN: D, F;
COMPN
I have written some code that logs into a list of hosts and runs a couple of
commands to find out some information. Which I then save to a file and process.
A cut down version of the information I generate and save can be found here -
http://pastebin.com/4ePz3Z7m
The code I have written to proc
On 14/03/13 01:39, DoanVietTrungAtGmail wrote:
You don't. You create a second table to hold the list.
Then in the second table you include be reference back to the first.
assuming I do it that way, how to deal with variable-length list? Most
lists have 10^3, but some can grow to perhaps
DoanVietTrungAtGmail wrote:
>> You don't. You create a second table to hold the list.
>> Then in the second table you include be reference back to the first.
>>
>
> I thought about that but thought it seemed a roundabout way. But assuming
> I do it that way, how to deal with variable-length list?
29 matches
Mail list logo