On 10/5/17, Chris Angelico wrote:
> On Thu, Oct 5, 2017 at 12:24 PM, Stefan Ram wrote:
>> One might wish to implement a small language with these commands:
>>
>> F - move forward
>> B - move backward
>> L - larger stepsize
>> S - smaller stepsize
>>
>> . One could start with the following pse
On Thu, Oct 5, 2017 at 12:24 PM, Stefan Ram wrote:
> One might wish to implement a small language with these commands:
>
> F - move forward
> B - move backward
> L - larger stepsize
> S - smaller stepsize
>
> . One could start with the following pseudocode for a dictionary:
>
> { 'F': lambda:
Stefan Ram wrote:
One might wish to implement a small language with these commands:
Explain why. What is the advantage?
F - move forward
B - move backward
L - larger stepsize
S - smaller stepsize
. One could start with the following pseudocode for a dictionary:
{ 'F': lambda: myturtl
On 2013-04-01, Steven D'Aprano wrote:
> On Mon, 01 Apr 2013 11:41:03 +, Neil Cerutti wrote:
>
>
>> I tried searching for Frost*, an interesting artist I recently learned
>> about.
>
> "Interesting artist" -- is that another term for "wanker"?
>
> *wink*
hee-hee. It depends on how much of a h
On Mon, 01 Apr 2013 23:53:40 +, Steven D'Aprano wrote:
> As far as I'm concerned, anyone in the 21st century who names themselves
> or their work (a movie, book, programming language, etc.) something
> which breaks search tools is just *begging* for obscurity, and we ought
> to respect their w
On 04/01/2013 07:53 PM, C.T. wrote:
Thanks for all the help everyone! After I manually edited the txt file, this is
what I came up with:
car_dict = {}
car_file = open('cars.txt', 'r')
for line in car_file:
temp = line.strip().split(None, 2)
temp2 = line.strip().split('\t')
i
Thanks for all the help everyone! After I manually edited the txt file, this is
what I came up with:
car_dict = {}
car_file = open('cars.txt', 'r')
for line in car_file:
temp = line.strip().split(None, 2)
temp2 = line.strip().split('\t')
if len(temp)==3:
year,
On Mon, 01 Apr 2013 11:41:03 +, Neil Cerutti wrote:
> I tried searching for Frost*, an interesting artist I recently learned
> about.
"Interesting artist" -- is that another term for "wanker"?
*wink*
> His name, in combination with a similarly named rap artist,
> breaks most search tools
On 2013-03-31, Roy Smith wrote:
> And, this is a good excuse to explore some of the interesting
> third-party modules. For example, mwclient ("pip install
> mwclient") gives you a neat Python interface to wikipedia. And
> there's a whole landscape of string matching packages to
> explore.
>
> We
On 03/31/2013 02:41 PM, Roy Smith wrote:
In article ,
Dave Angel wrote:
On 03/31/2013 12:52 PM, C.T. wrote:
On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote:
Thank you, Mark! My problem is the data isn't consistently ordered. I can
use slicing and indexing to put the year in
On 3/31/2013 11:52 AM, C.T. wrote:
Hello,
I'm currently working on a homework problem that requires me to create a
dictionary from a .txt file that contains some of the worst cars ever made. The
file looks something like this:
1958 MGA Twin Cam
1958 Zunndapp Janus
1961 Amphicar
1961 Corvair
1
In article ,
Dave Angel wrote:
> On 03/31/2013 12:52 PM, C.T. wrote:
> > On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote:
> >>
> >>
> >
> > Thank you, Mark! My problem is the data isn't consistently ordered. I can
> > use slicing and indexing to put the year into a tuple, but becaus
On 03/31/2013 12:52 PM, C.T. wrote:
On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote:
Thank you, Mark! My problem is the data isn't consistently ordered. I can use
slicing and indexing to put the year into a tuple, but because a car
manufacturer could have two names (ie, Aston Ma
On Sunday, March 31, 2013 12:38:56 PM UTC-4, Roy Smith wrote:
> In article ,
>
> "C.T." wrote:
>
>
>
> > Hello,
>
> >
>
> > I'm currently working on a homework problem that requires me to create a
>
> > dictionary from a .txt file that contains some of the worst cars ever made.
>
> > T
On Mon, Apr 1, 2013 at 4:19 AM, C.T. wrote:
> Thank you, Chris! I could use slicing and indexing to build the dictionary
> but the problem is with the car manufacturer an the car model. Either or both
> could be multiple names.
Then you're going to need some other form of magic to recognize whe
On Sunday, March 31, 2013 12:06:18 PM UTC-4, Chris Angelico wrote:
> On Mon, Apr 1, 2013 at 2:52 AM, C.T.
>
> > After playing around with the code, I came up with the following code to
> > get everything into a list:
>
> >
>
> > d=[]
>
> > car_file = open('worstcars.txt', 'r')
>
> > for line
On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote:
> Every line is now an element in list d. The question I have now is how can I
> make a dictionary out of the list d with the car manufacturer as the key and
> a tuple containing the year and the model should be the key's value. Here is
In article ,
"C.T." wrote:
> Hello,
>
> I'm currently working on a homework problem that requires me to create a
> dictionary from a .txt file that contains some of the worst cars ever made.
> The file looks something like this:
>
> 1958 MGA Twin Cam
> 1958 Zunndapp Janus
> 1961 Amphicar
> 1
>
> Every line is now an element in list d. The question I have now is how can
> I make a dictionary out of the list d with the car manufacturer as the key
> and a tuple containing the year and the model should be the key's value.
> Here is a sample of what list d looks like:
>
> ['1899 Horsey Hors
On Mon, Apr 1, 2013 at 2:52 AM, C.T. wrote:
> After playing around with the code, I came up with the following code to get
> everything into a list:
>
> d=[]
> car_file = open('worstcars.txt', 'r')
> for line in car_file:
> d.append(line.strip('\n'))
> print (d)
> car_file.close()
>
> Every l
Am 09.10.2012 13:59, schrieb arg...@gmail.com:
below is the text file i have How to create Facility as a key and then assign
multiple values to it
The value part of a dict element can be any kind of object, like e.g. a
tuple, namedtuple or even a dict.
Uli
--
http://mail.python.org/mailma
In article <50741ffe$0$6574$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Tue, 09 Oct 2012 04:59:49 -0700, argbsk wrote:
>
> > below is the text file i have How to create Facility as a key and then
> > assign multiple values to it
>
> To use Facility as a key in a dict:
>
>
On Tue, 09 Oct 2012 04:59:49 -0700, argbsk wrote:
> below is the text file i have How to create Facility as a key and then
> assign multiple values to it
To use Facility as a key in a dict:
d = {}
d['Facility'] = 'ham'
Note that keys are case-sensitive, so that 'Facility', 'facility',
'FACILIT
On Wed, 22 Aug 2007 07:13:40 +, james_027 wrote:
> I am trying to create a dictionary from a dictionary which the help of
> regex to identify which keys to select. I have something like this but
> I feel its long and not the fastest solution ... could someone
> contribute?
>
> import re
>
>
En Mon, 29 Jan 2007 23:45:40 -0300, mark <[EMAIL PROTECTED]> escribió:
> i have few variables and i want to create a dictionary with these
> variables
> such that the keys are the variable names and the corresponding values
> are the variable values.how do i do this easily?
> for ex:
> var1='mar
25 matches
Mail list logo