| |
thread by: Scott |
last post Apr 12 '07 by: Christophe
As said before I'm new to programming, and I need in depth explaination to
understand everything the way I want to know it, call it a personality quirk
;p.
With pop() you remove the last element of a list and return its value:
Now I know list is a bad name, but for the sake of arguement lets assume its
not a built in sequence>
'example'
|
thread by: Appu2008 |
last post Apr 23 '08 by: jlm699
Hi,
I have a dictionary whose keys are variables.
Eg: - dict=None
dict=value
Here lst and values are 2 variables. How can I make the key
as the value of lst.
For eg:- if lst="node1" and if value = 10,
this is what i needs..
dict=10
|
thread by: SpreadTooThin |
last post Sep 28 '06 by: Bruno Desthuilliers
f = open('myfile.bin', 'rb')
How do I know if there was an error opening my file?
|
thread by: Jeff Wagner |
last post Jul 18 '05 by: Patrick Useldinger
Is it possible to append a new Path to some file permanently? It seems like a
sys.path.append('/my/new/path') statement is temporary.
In other words, where and in what file on a Win32 box or Linux box is the sys.path info kept. I
have a couple of paths I keep practice files in I want to add to the path permanently.
Thanks
|
thread by: Merrigan |
last post Dec 14 '07 by: Chris
Hi There,
I'm sure I have done this before, but cannot remember how, or find out
how to do it quickly - but is there a way/function/something in python
to make all the letters of a raw_input() string small/capital letters?
Thanks!
-- Merrigan
|
thread by: Elezar Simeon Papo |
last post Feb 7 '06 by: Elezar Simeon Papo
Hello All,
I have a tab separated input file (data.txt) in text format - the file
looks like this
SCHOOL DEPART1 DEPART2 DEPART3
Harvard Economics Mathematics Physics
Stanford Mathematics Physics
Berkeley Physics
U.C.L.A Biology Genetics
|
thread by: ghostxx |
last post Jul 13 '10 by: new to python
Alright well i've been working at this for a ridiculously longer amount of time than i think i should have been, so i finally gave up and that's why im here. I program in C++ and hardly do any python.. ever. So i need a little help and hope you all will be kind enough to throw some knowledge my way.
What i need to do, is count the files in the...
|
| |
thread by: Sun |
last post Feb 16 '08 by: Steven D'Aprano
Maybe this is a very primative question, but I just get a bit confused about
'set' and 'Set' module in python.
I understand 'set' is a build in type in python after 2.4(or 2.3) and Set a
seperate module, anyhow, I gonna use build in 'set'.
then the question is how can I declare a empty set variable as a 'var= '
do to a list variable?
|
thread by: py |
last post Feb 10 '06 by: py
I have two lists which I want to use to create a dictionary. List x
would be the keys, and list y is the values.
x =
y =
Any suggestions? looking for an efficent simple way to do this...maybe
i am just having a brain fart...i feel like this is quit simple.
thanks.
|
thread by: Miguel Valenzue |
last post Sep 12 '12 by: bvdet
I want to round a list of numbers to basically remove all the decimal places or even just convert them to integers.
So this is what I've tried and I just can't get this to work.
myList = #declare my list
for i in range(len(myList)):
myList == round(i,0) #tries to round all numbers.
print myList
|
thread by: vj |
last post Dec 4 '06 by: Nick Craig-Wood
How do I do the following unix command:
mkdir -m770 test
with the os.mkdir command. Using os.mkdir(mode=0770) ends with the
incorrect permissions.
Thanks,
VJ
|
thread by: fordie1000 |
last post Jun 4 '12 by: eggmilk
Hi,
I have performed a fit to data using scipy's 'leastsq' function. However,
I wanted to be able to weight the fit by individual errors on the data points.
Here is an example of what I'm doing at the moment :
# fitting functions for the data
fitfunc = lambda p,x: p + p*x
|
thread by: Gregory Piñero |
last post Mar 22 '06 by: Gregory Piñero
Hey guys,
I don't understand why this isn't working for me. I'd like to be able
to do this. Is there another short alternative to get this
intersection?
>>> set().intersection()
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: dict objects are unhashable
|
thread by: gmax2006 |
last post Aug 8 '06 by: Damjan
Hi,
I am using RedHat Linux 4. and I developed an oracle 10g based
application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and
Python 2.3.4.
When I run the application through direct console connection, It works
perfect.
But, when I schedule a crontab job to run the application, It logs this
|
thread by: Fuzzyman |
last post Mar 1 '06 by: Aahz
What gives ?
>>> a =
>>> def f():
return a
>>> f()
>>> a.append(3)
>>> f()
|
| |
thread by: bvdet |
last post Dec 7 '06 by: bvdet
Python 2.3 Windows XP
We have a builtin module 'point'. I am trying to determine a better way to check the type of a list of 'point' objects. A point object is created:from point import Point
pt1 = Point(x_coord, y_coord, z_coord)
print type(pt1)
<type 'point'>
print dir(pt1)
Original code:
def chk_type(p_list):
...
|
thread by: bkunjitam |
last post Apr 3 '15 by: wordsforthewise
Hi,
How do i add a drop down box with few pre-populated strings in the same?
I could find list box and drop down menu in the HELP document of Python, but not drop down box.
Please help me in this.
Thanks,
BK
|
thread by: cato9999 |
last post Jan 2 '08 by: bvdet
Hello World! (yes, I am a completely new to the programming scene, and this is my first post ever)
Working in Python, I want to create a separate .txt file for each of the items in a list of strings. Simplified setup:
list =
type(list)
type(list)
type(list)
for item in list:
g = open(item,'w')
|
thread by: hankssong |
last post May 10 '06 by: Antoon Pardon
Hi everyone, I'm wondering whether it's possible to construct a
binary-tree using python.
Since python don't have pointer, it can't dynamically allocate memory
like C language.
But some important data structures like linked list, binary-tree and
hash table are closely linked with dynamic memory technology.
Any help that can be provided...
|
thread by: tertius |
last post Jul 18 '05 by: tertius
Is there a better way to append certain chars in a string with a
backslash that the example below?
chr = "#$%^&_{}" # special chars to look out for
str = "123 45^ & 00 0_" # string to convert
n = "" # init new string
for i in str:
if i in chr: # if special character in str
n+='\\' # append...
|
thread by: miago |
last post Feb 6 '07 by: dshimer
Searching this forum I found an example of running Unix commands from Python;I wonder if there is a way to get the output of windows commands on a string using Python.Thanks in advance;
Miago.
|
thread by: thompson.marisa |
last post Dec 20 '06 by: thompson.marisa
Hi.
I'm extremely new to Python and programming as a whole. I have written
a python script with the assistance of ESRI ArcGIS 9.2, which uses
Python 2.4.1, however, it gives me this error when I try to run it.
I've already posted at ESRI support, and I was hoping that Python
people could help me more.
I hope there is something simple I...
|
thread by: Bob Roberts |
last post Jul 18 '05 by: Terry Reedy
I'm sure there must be a better way to do this:
try:
if item.page:
DoSomething()
except AttributError:
pass
Is there a simple way to check if item has "page" as one of its attributes?
|
| |
thread by: franck |
last post Jul 18 '05 by: Steve Holden
HI,
this is my code
params = {}
params = '*****';
params = '***';
params = '**********';
params = '******';
params = '****';
|
thread by: Kenneth McDonald |
last post Aug 23 '05 by: Bengt Richter
I could've sworn python had such a command, but now I can't find it...
I'm looking for an easy way to perform a UNIX-style "touch", to
update the modification time of a file without actually modifying it.
I could do something (I imagine) like opening the file for appending
and then immediately closing it, but that doesn't seem like a good...
|