Gabriele Brambilla wrote:
> Ok guys, when I wrote that email I was excited for the apparent speed
> increasing (it was jumping the bottleneck for loop for the reason peter
> otten outlined).
> Now, instead the changes, the speed is not improved (the code still
> running from this m
bruce wrote:
> The following text contains sample data. I'm simply trying to parse it
> using libxml2dom as the lib to extract data.
>
> As an example, to get the name/desc
>
> test data
>
>
> d = libxml2dom.parseString(s, html=1)
>
> p1="//department/name"
> p2="//department/desc
Qianyun Guo wrote:
> Hi all, I am trying to get a suffix tree from a string. I use three
> classes, Node, Edge, SuffixTree. I have two questions when implementing:
>
> 【1】
>
a = Edge(1,2,3,4)
>
a.length
>
> 1
> if I remove '@property' in my code, it returns as below:
>
a = Edg
Wheeler, Gabriel wrote:
> Im having trouble completing this function with lists. Im supposed to
> create a function that will let me know if there are repeating elements so
> I wrote this and am not sure where the error lies.
It helps you (and us) a lot if you clearly state the error you are see
Vipul Sharma wrote:
> Hello,
>
> Suppose we want some block of code to be executed when both '*a'* and
> '*b'*are equal to say 5. Then we can write like :
>
> *if a == 5 and b == 5:*
> *# do something*
>
> But a few days ago, I just involuntarily wrote a similar condition check
> as
> :
>
Peter Otten wrote:
> In mathematics there is a property called "transitivity" which basically
> says that an operation op is transitive if from
>
> (a op b) and (a op c)
>
> follows
>
> b op c
I opened the wikipedia article for the english word, but didn
Albert-Jan Roskam wrote:
>
>
>
>
>
> - Original Message -
>> From: Steven D'Aprano
>> To: tutor@python.org
>> Cc:
>> Sent: Thursday, April 24, 2014 3:00 AM
>> Subject: Re: [Tutor] global list
>>
>
>
>
>> You only need to define variables as global if you assign to them:
>>
>> de
Alan Gauld wrote:
> I've been playing with the logging module - long overdue!
>
> I started with the basic tutorial but fell at the first hurdle.
> It says to specify a file in the logging.basicConfig() function then
> asks you to open the file after logging some events.
>
> But I can't find the
Stephen Mik wrote:
> My program, Assignment4,does run partially. You can see the results of the
> Python Shell attached to this email. I also have included part of my code
> for your perusal.
>
> I must be doing something very wrong. The program is supposed to run a
> main loop ,for control of th
Stephen Mik wrote:
> Stephen Mik-novice programmer-getting desperate
Don't despair just yet! As a programmer you will be constantly producing and
fixing errors. That is business as usual.
What will change is that you will produce trickier bugs as your knowledge
level increases...
> Dear Sir(s)
Ian D wrote:
> I am trying to follow some code. It is basically a python scratch
> interfacing script.
> Anyway part of the script has this code.
> Searching google for >> greater than signs in code with python has its
> issues.
> Can anyone clarify this stuff.
> I know its about 4 bytes of data.
Ian D wrote:
> Can anyone clarify please?
>
>
> Just reading this:
> https://wiki.python.org/moin/BitwiseOperators
> The section on 2's complement binary for negative integers.
> It states:
> "Thus the number -5 is treated by bitwise operators as if it were written
> "...11101
Ian D wrote:
> I have this part of code and am unsure as to the effect of the array('c')
> part. Is it creating an array and adding 'c' as its first value?
No, the first arg to array.array() is the typecode; data may be passed as
the second argument. The typecode "c" creates an array of 8-bit ch
Felipe Melo wrote:
[Felipe, please post plain text, your code examples are unreadable]
> Hello,
> I'm starting with Python and I'm trying to work with "import" but I'm
> having a problem. I have the file c.py (that works when executed) with a
> function performing a multiplication:
> def mult(a,x
C Smith wrote:
> I meant for example:
> list1 = [1,2,3]
> list2 = [3,4,5]
>
> newList = list1 + list2
>
> versus
>
> for x in list2:
>list1.append(x)
>
> Which is the preferred way to add elements from one list to another?
None of the above unless you need to keep the original list1. Use
Sithembewena Lloyd Dube wrote:
> Thanks, i was actually getting the error information to update the post.
> Apoligies to waste your time posting here - I could not find an
> appropriate PyCountry discussion list and my next best bet seemed to be a
> Python users' list.
>
> For those who care to l
Jake Blank wrote:
> I finally got it.
> This was the code:
> for k in sorted(word_count, key=lambda x:word_count[x], reverse=True):
> print (k, word_count[k])
>
> The only question i have now is how to limit the amount of returns the
> program runs to the first 15 results.
Hint:
ani wrote:
> So I thought it would be cool to read a sequence at three different
> frames, which I have pasted below. However, I've come across a conundrum:
> how to make a list of lists. See, I'd like a final output that displays
> data of the type of frame with a + or a - to signify the directio
Felipe Melo wrote:
> Hello,
>
> I want to read the below matrix, identify when the characters in front of
> "want = " are equal to "1" and then save in an array and in an output file
> the characters above. But I don't know how to identify the second line and
> store in a variable:
>
> alpha=0 b
Alan Gauld wrote:
> On 23/05/14 12:57, SABARWAL, SHAL wrote:
>> Wondering if anyone came across this error in using form =
>> cgi.FieldStorage()
>>
>> import tempfile
>>
>> File /tempfile.py", line 83, in _once_lock
>> = _allocate_lock()
>>
>> thread.
diliup gabadamudalige wrote:
> I need to random pick a pygame sprite from a sprite class.
> The random module does not allow this to be used on a group.
> Is the shortest way to raed in the attributes thatr I need into a list and
> then random pick that or is there a shorter way? Sample code is gi
jarod...@libero.it wrote:
> Dear All
>
> clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra","
> electra"]
> clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia",
> "sally"," Castiel","Sam"]
>
> I have a list of names that I would to annotate in function of pr
Ritwik Raghav wrote:
> I joined the topcoder community tomorrow and tried solving the
> PersistentNumber problem:
> "Given a number x, we can define p(x) as the product of the digits of x.
> We can then form a sequence x, p(x), p(p(x))... The persistence of x is
> then defined as the index (0-base
jarod...@libero.it wrote:
> Dear all thanks for your suggestion!!!
> Thanks to your suggestion I create this structure:with open("prova.csv")
> as p:
> for i in p:
> lines =i.rstrip("\n").split("\t")
>...: print lines
>...:
> ['programs ', 'sample', 'gene', 'values']
>
Gabriele Brambilla wrote:
> 2014-06-05 22:10 GMT-04:00 Peter Romfeld :
>
> On Friday, June 06, 2014 10:04 AM, Gabriele Brambilla wrote:
>>>
>>> fiLUMOname = 'Lsum_' + period + '_' + parts[2] + '_' + parts[3] + '_'
>>> + parts[4] + '_*.dat'
>>>
>>> aaa = glob.glob(fiLUMOname)
>>> print(aaa)
>>> fi
Lukas Nemec wrote:
> Hi,
>
> fist - are you really triyng to have open 64 000 ports? ok, i suppose
> you have your reasons, but this is not a good idea - you'll block most
> applications that use these ports ..
>
> The problem is with your main function -
> you have PORT defined, but it is not g
I'm posting via gmane. Since last month there is a delay (usually a few
hours I think) until my posts appear and I seem to be getting a
"Your message to Tutor awaits moderator approval, would you like to
cancel..."
mail every time I post. I'm trying hard to not get annoyed ;)
Is there somethin
Jon Engle wrote:
> Ok, so when I run the code it immediately terminates and never 'listens'
> to the ports in the loop. I have verified by running netstat -an | grep
> 65530 and the startingPort is not binding.
As I've already hinted the easiest way to keep your listening threads alive
is to use
Alan Gauld wrote:
> On 10/06/14 09:43, Peter Otten wrote:
>> I'm posting via gmane. Since last month there is a delay (usually a few
>> hours I think) until my posts appear and I seem to be getting a
>>
>> "Your message to Tutor awaits moderator
Alan Gauld wrote:
> On 11/06/14 00:08, Jon Engle wrote:
>> Ok, so when I run the code it immediately terminates and never 'listens'
>
> This has nothing to do with your immediate problem but...
>
>> ***Code***
>>
>>#!/usr/bin/python # This is server.py file
>> from socket impo
Mirage Web Studio wrote:
> I am new to python programming. while trying it out i find that in my
> code file io.read is not reading large files particularly over 1 gb. my
> code is posted below. i am working on python 3.3 on windows with ntfs
> partition and intel corei3 ram 3gb. the execution a
Mirage Web Studio wrote:
> Try reading the file in chunks instead:
>
> CHUNKSIZE = 2**20
> hash = hashlib.md5()
> while True:
> chunk = f.read(CHUNKSIZE)
> if not chunk:
> break
> hash.update(chunk)
> hashvalue = hash.hexdigest()
>
>
> Thank you peter for the above valub
Aaron Misquith wrote:
> I'm trying to obtain the questions present in StackOverflow for a
> particular tag.
>
> Whenever I try to run the program i get this *error:*
>
> Message File Name Line Position
> Traceback
> C:\Users\Aaron\Desktop\question.py 20
> UnicodeEncodeError: 'ascii' codec c
Ben Sherman wrote:
> Whats a more pythony way to do this? I have a dict with a few dozen
> elements, and I want to pull a few out. I've already shortened it with
> itemgetter, but it still seems redundant. I feel like I can do something
> like I've seen with *kwargs, but I'm not sure.
>
> I'm
Ian, take a step back; the first step to solve a problem is to state it
clearly. You want to write a dict to a file.
(1) What would the dictionary look like? Give concrete example, e. g.
{"foo": 42, "bar": 'that\'s not "funny"'}
(2) What should the resulting file look like when you open it in a
mark murphy wrote:
> Hello Python Tutor Community,
>
> This is my first post and I am just getting started with Python, so I
> apologize in advance for any lack of etiquette.
>
> I have a directory of several thousand daily satellite images that I need
> to process. Approximately 300 of these i
Peter Otten wrote:
> for fileset in days.values():
> if len(fileset) > 1:
> # process only the list with one or more files
That should have been
# process only the lists with two or more files
> print(&qu
Alex Kleider wrote:
> On 2014-06-24 14:01, mark murphy wrote:
>> Hi Danny, Marc, Peter and Alex,
>>
>> Thanks for the responses! Very much appreciated.
>>
>> I will take these pointers and see what I can pull together.
>>
>> Thanks again to all of you for taking the time to help!
>
>
> Assum
Myunggyo Lee wrote:
> I'm trying to figure out the reason of error but i couldn't find it.
> first imports short.txt(is attached to this mail)
> and read in dictionary named gpdic1
>
>
> Traceback (most recent call last):
> File "/home/ercsb/test.py", line 11, in
> hgene = lines[1]
> Inde
Mario Py wrote:
> OK, I'm finally getting closer.
>
> Code bellow (looks like) works if I comment out shuffle part
> But I need it to shuffle so I get random picked words.
>
> How do I get shuffle part to work?
csv.reader() returns an iterator, i. e. an object that dynamically
calculates new r
Albert-Jan Roskam wrote:
> I created a small menu with Tkinter. It has two listboxes: a source and a
> destination box. The user can select files from the source box and 'move'
> them to the destination box. It now does what I want, except for one
> thing: when I resize it, the listboxes will not
Bob Williams wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I'm using Python 2.7.6 on an openSUSE linux system.
>
> I'm trying to convert a shell (bash) script to a python script, and
> everything's worked OK except this. The following line in the shell script
>
> btrfs subvolume
Avishek Mondal wrote:
> Hi,
>
> I wrote a simple program, as follows-
> def finddivisor(n1, n2):
> divisor = ()
>
> for i in range(1, min(n1+n2)+1):
> if n1%i == 0 and n2%i==0:
> divisor = divisor + (i, )
> return divisor
>
> n1 = eval(input('Enter first number: '))
> n2 = eval(input('Enter sec
Steve Rodriguez wrote:
> Hey guys n gals,
>
> New to python, having some problems with while loops, I would like to make
> a program quick once q or Q is typed, but thus far I can only get the
> first variable to be recognized. My code looks like:
>
> message = raw_input("-> ")
> while m
Peter Otten wrote:
> PS: You sometimes see
>
> message in "qQ"
>
> but this is buggy as it is true when the message is either
> "q", "Q", or "qQ".
Oops, I forgot "".
___
Tutor
jarod...@libero.it wrote:
> Hin there!!!
>
> I have a niave question on dictionary analysis:
> If you have a dictionary like this:
> diz
> Out[8]: {'elenour': 1, 'frank': 1, 'jack': 1, 'ralph': 1}
>
> and you have a list and you want to know which keys are not present on my
> dictionary the cod
C Smith wrote:
I'd throw in a check to verify that filename is indeed a flac:
> or more accurately
> import os, subprocess, re
> directory = '/abs/path'
> for track, filename in enumerate(os.listdir(directory), 1):
> pathname = os.path.join(directory, filename)
if filename.endswith(".fl
C Smith wrote:
> Nice, these are useful tools. I have been building something with just
> basic stuff and avoiding learning any libraries. If I wanted to get
> some insight on a larger program that is about 1000 lines, would that
> be doable here?
In general we prefer concrete questions and small
Marcus Mravik wrote:
> I am trying to specify a number based on what the selected object number
> in the scene is.
>
> import bpy
>
> for obj in bpy.context.selected_objects:
>
> bpy.context.scene.objects.active = obj
>
> bpy.ops.graph.sound_bake(filepath="C:\\Users\\Marcus\\Music\\Don
Ken G. wrote:
> Receiving the following error from the terminal screen:
>
> Traceback (most recent call last):
>File "Blood Pressure05Print45.py", line 95, in
> pr.write(totalSystolic)
> TypeError: expected a character buffer object
>
> Portion of strip:
> =
>
> pr.wri
Bill wrote:
> Thanks for yoru reply. This was my first attempt,when running through
> idleid get the following error:-
>
>
> Traceback (most recent call last):
> File "C:\Users\Bill\Desktop\TXT_Output\email_extraction_script.py", line
> 27, in
> traverse_dirs(working_dir)
> File "C:\Use
王学敏 wrote:
> Dear Python Users,
>
> Attachment is python code.
>
> The function of this code is that I want to insert lots of fiber into
> matrix, data is a list storing translate vector. When a fiber is
> translated to matrix, I used fiber to cut matrix. So the new part will be
> generated, I d
Terry--gmail wrote:
> Marc, my understanding is, is that:
>
> lens[col].append(len(item))
>
> -should be building a mirror image of my list of lists called catalog2,
> which currently has 9 columns by x number of rows, and that we are
> plugging into these positions, the sizes of all the el
Lucia Stockdale wrote:
> Hi everyone,
>
> I have been writing a program to print words backwards until an an empty
> line of input is entered, but after I put in the input it comes up with
> TypeError.
In the future please include the traceback (cut and paste, don't rephrase).
> This is my goa
Peter Otten wrote:
> I see another problem, the while loop will run at most once, but you
> should be able to fix that yourself.
Sorry, it will run forever reversing and unreversing the same string...
___
Tutor maillist - Tutor@python.
Flynn, Stephen (L & P - IT) wrote:
> The documentation (https://docs.python.org/3/library/sys.html) for
> Python 3.4.1 says that "This module provides access to some variables
> used or maintained by the interpreter and to functions that interact
> strongly with the interpreter. It is always avail
Martin A. Brown wrote:
> I think item 2. about bash_completion bit is outside the scope of
> Python, specifically, though, and more of an operating environment
> thing.
I have recently (re)discovered that there is an easy way to get bash
completion:
https://pypi.python.org/pypi/argcomplete
I'
leam hall wrote:
> Am I asking the wrong question? How do older apps with older versions
> of python (2.4.x) separate code into sub-directories? Do they?
Even new versions allow relative imports only inside packages. Given a tree
$ tree
.
├── alpha
│ ├── beta
│ │ ├── __init__.py
│ │ └─
Richard Dillon wrote:
> I apologize in advance - This is my third week using Python (3.4.1 on a
> Mac)
>
> I need to read a text file, convert the values into numbers and calculate
> a total. The total I get doesn't match the values entered in the file.
>
> def main():
> total = 0
> infi
Albert-Jan Roskam wrote:
> I want to import a module upon instantiation (not definition) of a class.
> What is the best way to do this? In my case, I need the "icu" module in
> only one place/class of the program. If that class won't be used, I don't
> want to have an ImportError. Also, it might b
Jan Karel Schreuder wrote:
> Until now I have used IDLE to write and run programs. I decided it was
> time to do it the hard way and use only a Terminal and a plain text
> editor, TextWrangler. I have Python 3.4.1 and OS 10.8.5. When I run the
> script by calling for the interpreter in the termina
Juan Christian wrote:
> I'm writing a program that have a 'User' class. This class will have the
> following attributes:
>
> 1. id
> 2. personaname
> 3. lastlogoff
> 4. profileurl
> 5. avatar
> 6. realname
> 7. timecreated
> 8. loccountrycode
>
> I'm thinking about writing something like that:
Juan Christian wrote:
> On Sun, Sep 7, 2014 at 5:04 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> It's not a good approach and it's not pythonic.
>>
>> In Python you should avoid accessor functions and (pseudo-)private
>> __attributes ("
Juan Christian wrote:
> I'll definitely use the '@property' decoration. Thanks for the tip,
Personally I'd use normal attributes, though.
> so, a
> different module to accommodate all the API requests and one for the
> logic/code itself is a better approach, right?
A separate function or meth
Juan Christian wrote:
> On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote:
>> Personally I'd use normal attributes, though.
>>
>
> Why normal attributes? Isn't it better to make these read-only as I won't
> ever need to modify the
Juan Christian wrote:
>>
>> > On Mon, Sep 8, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> In that spirit here's an alternative implementation of the User class:
>>
>> from collections import namedtuple
>> User = namedtupl
Mimi Ou Yang wrote:
> print ("Quiz TIME!!!")
> ready = input("Are you ready?")
> if (ready in ("yes","YES","Yes")):
> print ("Alrighty")
> if (ready in ("no","NO","No")):
> print ("Too bad so sad. You're obligated to do it.")
> else:
> print ("OK (sarcasm)")
> When I write yes or YE
jarod...@libero.it wrote:
> I want to use subprocess for run some programs But I need to be sure the
> program end before continue with the other:
>
> subprocess.call("ls")
> cmd1 = i
> p1 = subprocess.Popen(cmd1,shell=True,stdout=subprocess.PIPE)
>
> while True:
> if p1.poll() is None:
> time.s
Sydney Shall wrote:
> On 08/09/2014 18:39, Alan Gauld wrote:
>> On 08/09/14 15:17, Juan Christian wrote:
>>
>> One tiny tweak...
>>
>>> class User():
>>
>> You don't need the parens after User. You don;t have any superclasses
>> so they do nothing. Python convention for an empty parent list is jus
Wolfgang Maier wrote:
> On 09/09/2014 11:45 AM, Peter Otten wrote:
>> jarod...@libero.it wrote:
>>
>>> I want to use subprocess for run some programs But I need to be sure the
>>> program end before continue with the other:
>>>
>>> subprocess.cal
Radhika Gaonkar wrote:
> I have an implementation of lsa, that I need to modify. I am having some
> trouble understanding the code. This is the line where I am stuck:
>
> DocsPerWord = sum(asarray(self.A > 0, 'i'), axis=1)
>
> The link for this implementation is :
> http://www.puffinwarellc.com/
Juan Christian wrote:
> Let's say I have the following list: my_list = ['76561198048214059',
> '76561198065852182', '76561198067017670', '76561198077080978',
> '76561198077257977', '7656119807971
> 7745', '76561198088368223', '76561198144945778']
>
> and I have a function with the following signa
Carmel O'Shannessy wrote:
> times = ['50.319468', '50.319468', 't1']
>
> I want to convert [0:2] to floats.
>
> I tried:
>
> float.times = [float(i) for i in times[:2]]
>
> but get the error msg:
>
> TypeError: can't set attributes of built-in/extension type 'float'
Try
times[:2] = [floa
Juan Christian wrote:
> On Thu, Sep 11, 2014 at 4:39 PM, Juan Christian
> wrote:
>>
>> Using 3.4.1
>>
>> I did try:
>>
>> self.persona_name = unicode(personaname)
>> self.persona_name = personaname.decode("utf-8")
>>
>> But didn't work!
>>
>
>
> Some of the chars that brakes the program:
>
> \
Juan Christian wrote:
> On Thu, Sep 11, 2014 at 5:23 PM, Peter Otten <__pete...@web.de> wrote:
>>
>>
>> You are getting an *encoding* error, so this may be triggered when you
>> are trying to print. Can you post the traceback?
>>
>> Also, what is yo
questions anon wrote:
> I think this should be simple but I can't find the right commands.
>
> I have a date for each hour for a whole month (and more) and I would like
> to write a loop that prints each date that is different but skips the
> dates that are the same.
>
> for i in date:
> print i
Juan Christian wrote:
> My code:
>
> import requests
> import bs4
>
>
> FORUM_ID = "440"
>
> response = requests.get('
> http://steamcommunity.com/app/{id}/tradingforum'.format(id = FORUM_ID))
> soup = bs4.BeautifulSoup(response.text)
> topics = [a.attrs.get('href') for a in
> soup.select('a.f
Juan Christian wrote:
> Using the default json lib is easy and straightforward:
>
> import json
> info = json.loads('file.json')
> # Use dict and list to navigate through 'info'
>
>
> Sadly, I'm working in a script and the only format the server gives is
> XML, I searched for a good alternative
Sunil Tech wrote:
> Danny i did it like this
>
> result_dict = {}
> for i in tes:
> if i['a'] in result_dict:
> temp = result_dict[i['a']]
> temp['b'].append(i['b'])
> temp['c'].append(i['c'])
> temp['a'] = i['a']
> result_dict[i['a']] = temp
> else
Juan Christian wrote:
> This part of my code isn't working:
>
> def check_backpacktf(steamID64):
> with requests.get(''.join([BACKPACKTF, steamID64])) as response:
> status = {'profile': ''.join([BACKPACKTF, steamID64]),'backpack_value':
> 'Private or invalid', 'steamrep_scammer': False}
>
> wit
Danny Yoo wrote:
> I should have added that you can write your own context manager for
> requests; it shouldn't be too bad. I'd expect the helper code to be
> something like:
> class AutoClosable(object):
> def __init__(self, closable):
> self.closable = closable
>
> def __enter
Juan Christian wrote:
> On Fri, Sep 19, 2014 at 3:15 PM, Peter Otten <__pete...@web.de> wrote:
>>
>> Let's take a step back: if you were to write
>>
>> > with requests.get(''.join([BACKPACKTF, steamID64])) as response:
>> > status =
Juan Christian wrote:
> This is the code using the contextlib (more than 105 lines):
> http://pastebin.com/jVhz7Ta6
>
> But I'm getting another (super confusing) error now:
>
> [#] [Tf2 inventory [W]CS GO Skins
> Author: Pnoy Paragon << UNTIL HERE, OK!
>
> Traceback (most recent call la
Juan Christian wrote:
> On Fri, Sep 19, 2014 at 4:30 PM, Peter Otten <__pete...@web.de> wrote:
>>
>> Well, you import closing from the stdlib with
>>
>> from contextlib import closing
>>
>> and then proceed to write your own closing
>>
&
Juan Christian wrote:
> So, I'm coding a software using Flask and sqlite3 on Ubuntu 14.04, I read
> that on Python 3.4.1, sqlite3 is default, but when I try to 'import
> sqlite3' I get:
>
> Traceback (most recent call last):
> File "flaskr.py", line 5, in
> import sqlite3
> File "/usr/lo
Paul Smith wrote:
> Early stages messing with module sqlite3 in python3.4. I am successful in
> creating sqlite tables of my own and interacting with other sqlite tables,
> however in refining the code from a purely "it can do it" stage to a more
> stable working piece of code I run into this prob
Armindo Rodrigues wrote:
> Hi everyone,
>
> This is my first post so I don't know if I am asking the correct way so
> let me know if I messed anything up.
>
> ***Please note. My code contains a list of quotes that has many lines. I
> have noted the beginning and end of the quotes list so you can
Stefan St-Hilaire wrote:
> Hello, I am just starting out with Python and ran into a problem
> day one. I am doing this statement:
>
> input("\n\nPress the enter key to exit.")
>
> I get the following error:
>
> >>> input("\n\nPress the enter key to exit.")
>
>
> Press the enter key to e
John Doe wrote:
> Hello List,
> I am in need of your assistance. I have a text file with random words
> in it. I want to write all the lines to a new file. Additionally, I am
> using Python 2.7 on Ubuntu 12.04:
>
> Here is my code:
>
> def loop_extract():
> with open('words.txt', 'r') as f:
Clayton Kirkwood wrote:
> I was trying to keep it generic.
> Wrapped data file:
>data-model="name:DatumModel;id:null;" data-tmpl="">data-ylk="cat:portfolio;cpos:1"
>href="http://finance.yahoo.com/q?s=SWKS";
>
Clayton Kirkwood wrote:
>
>
> !-Original Message-
> !From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
> !Behalf Of Peter Otten
> !Sent: Tuesday, October 07, 2014 3:50 AM
> !To: tutor@python.org
> !Subject: Re: [Tutor] search/match file p
Felisha Lawrence wrote:
> I have the following program
> import os
>
> path = '/Users/felishalawrence/testswps/vol1'
> for file in os.listdir(path):
> newFile = path+file[:file.rindex("v")]+"v20"
>
> print newFile
> and I want to output the results of the 'newFile' variable in
William Becerra wrote:
> Hey, I'm new to programming.
> Only have about 2 weeks of experience.
> Using Python 2.7.8 and running Windows 8
> I'm having the following problem.
>
> I open Python shell press file, new file and write my code(any code)
> then all the Python keywords appear in their di
George R Goffe wrote:
> When you run a python program, it appears that stdin, stdout, and stderr
> are opened automatically.
>
> I've been trying to find out how you tell if there's data in stdin (like
> when you pipe data to a python program) rather than in a named input file.
> It seems like mo
Clayton Kirkwood wrote:
> raw_table = ('''
> a: Asky: Dividend Yield
> b: Bid d: Dividend per Share
> b2: Ask (Realtime) r1: Dividend Pay Date
> b3: Bid (Realtime)q: Ex-Dividend Date
> p: Previous Close
> o: Open''')
> o: Open#why aren
Alan Gauld wrote:
> Finally when creating tables you can use:
>
> DROP TABLE IF EXISTS TOPICS;
>
> Prior to creating it. That will ensure you don't get an existing
> table error.
Another option is to only create the table if it does not already exist:
create table if not exists topics ...
__
Al Bull wrote:
> Quick question then...
>
> Does this do the trick?
I may have misunderstood your original question; do you want to delete
records from the database or from the Python list? Your code below will do
the latter, once you have fixed the bugs.
> Currentrecord = 1
>
> While curre
Bo Morris wrote:
> "...Regarding your program, instead of writing long sequences of
> repetitive if
> conditions, I would write one function for each of the different
> operations and store them in a dict, mapping each host name to a function
> (and multiple host names may map to the same function
Bo Morris wrote:
> Thank you all for the helpful criticism. I wish I was able to catch on to
> what you are suggesting more quickly.
>
> Based on your recommendations, I have come up with the following so far,
> however I just dont see it as easily as I did while using the if/elif
> statements.
>
Clayton Kirkwood wrote:
> description_string=code_string=''
>
> description = code = 'a'
>
> for (description_position, code_position) in (description, code):
>
> print(description_position,code_position)
> I have tried variations on this for statement, and it doesn't work:<)))
> Both desc
901 - 1000 of 1325 matches
Mail list logo