@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> Inside a loop, what's the easiest way of adding characters to a string?
<0> Oh, and hello :)
<1> +=
<0> Is that how you concatenate?
<1> + concatenates
<0> So c = c + 'asd' works when c is a string?
<1> yes
<0> ty.
<1> you can also make a list of strings and join them with ''.join(the_list)
<1> I'm not sure if that's faster
<1> it probably depends
<0> printing str_b shows me a list instead of a string. why? x_new is a character (tuple?): str_b = str_b + str(x_new
<0> s/x_new/x_new)/
<0> I see more or less this: ('k',)('$',)('j',)('q',)('r',)
<0> instead of : k$jqr
<1> x_new is a tuple containing a single character?



<0> yes
<0> forgive my n00bness
<1> uh, is there a reason for that?
<0> I'm trying to understand string manipulation with python.
<1> it seems kind of odd
<1> ok, that is a string
<1> when you print a string, it doesn't show the quotes
<0> what do you mean?
<0> it looks ugly, I just want the string printed out.
<1> when you print a string, it just prints the contents of the string
<1> it doesn't print a representation of it in python
<1> that's what the string really looks like
<0> ah
<0> do you know why it's doing that?
<1> when you convert a tuple to a string with str(), it gives you a python representation of the tuple
<0> oh
<0> so there lies the problem?
<1> yeah
<1> if it always contains one character, you should just get the character from the tuple with something like x_new[0]
<1> but there might be a more direct way to fix it depending on why x_new is a tuple
<0> it is a tuple because I am iterating over a string
<1> uh, normally iterating over a string just gives you characters
<1> it doesn't give you tuples
<1> can I see your code?
<0> maybe it does. that's why I said "tuple?", heh. I was asking if characters == tuples
<0> of course.
<1> a character is just a string of length 1
<1> you have tuples containing one character, and I have no idea why that is
<0> http://pastebin.com/571063
<1> x_new = chr(ord(x)+4),
<0> ah
<0> :)
<1> the trailing comma is telling it to create a tuple
<0> oh really?
<1> yeah
<0> d'oh
<0> works fine now :)
<0> thanks a lot
<0> I can now concatenate x_new without calling its first character (x_new[0])
<1> also
<1> for x in str_a[:]:
<1> why do you do the [:] ?
<0> How else might I get the same result?
<1> you don't need the [:] at all
<1> it doesn't change str_a
<0> right. it was going to in the first place.
<0> but I changed the design a bit :)
<0> well, thanks again.
<1> even then, strings are immutable
<2> greetings all
<2> anyone have a copy of movpy?
<3> how do I get the user directory of the currently logged in user? unix and windows, if they are different
<4> getp***.getuser()
<4> It's not guaranteed to return anything, though, and will throw an exception.
<4> .. if it doesn't find any.
<4> Don't rely on it for security, it gets it from environment variables.
<3> security isn't an issue for my usage, and well, that only gets me the username... hmm, ok I see I can use the pwd module on unix... still, how do I do that on windows? please tell me I don't need to get down to C
<4> Oh, directory.
<4> Try os.path.expanduser("~").
<3> ah, thanks.. that works on OSX at least.. need to check it out on windows
<4> The doc suggests it might throw an exception, it relies on an environment variable on Windows.



<3> well that's pretty bogus, there's no such env var set on windows by default
<3> I guess I'll have to drop down to C then
<4> Uhm, it is here.
<3> well not on my win2k adv server machine it's not set at least :P
<4> C:\>echo %HOMEDRIVE%%HOMEPATH%
<4> C:\Documents and Settings\Marius
<3> hmm, ok, you're right, %HOME% isn't set though
<5> how do write some value to the registry using python
<5> ?
<3> http://www.python.org/doc/2.3.5/lib/module--winreg.html
<6> hund: Busted, windows user.
<4> Right now I am.
<7> i use windows as my love slave
<4> Linux doesn't run HL2. :P
<6> Oh my, I never thought you were a gamer, hund
<4> Nah. Gamers see games as a way of life. I just do it if I'm bored enough.
<8> yeah, my Windows machine is only for playing games
<4> It's kinda like reading slashdot, except it's fun.
<4> Dell only ships firmware upgrades for Windows, too.
<8> and you can learn something (how to kill people)
<8> also unlike Slashdot
<6> Digg is more fun than Slashdot
<4> You can also screw up your right arm without kittens being killed. Think of the kittens.
<6> Didn't think I could use screen as a minicom/tip substitute
<6> found out I can use screen /dev/<serial device> and boom, it works.
<6> funny, I haven't had a Windows machine since 1996 or so. It all works out when you don't play games on your PC, I can tell you ;)
<4> I'm too lszy to buy a playstation.
<4> Playstations won't play VSTs, either.
<8> FPS games **** on consoles
<8> of course you have to have a nice gaming machine to appreciate a good PC game, but still ...
<4> It works sometimes. GTA: San Andreas on PS2 is smooth.
<4> Halo is just stupid.
<8> much nicer at 1600x1200 on a PC
<8> and that's not a FPS :_0
<8> yes, Halo is embar***ingly bad
<4> What's not a FPS?
<8> GTA:SA
<4> It's not?
<8> no, it's a third person shooter
<8> either way, playing anything at TV resolution just drives me crazy
<4> It's technologically the same, the camera is just translated backwards.
<8> sure, but the gameplay of something like GTA:SA and F.E.A.R. or HL2 are completely different
<8> FPS and TPS games may "just" have different cameras technically but they also imply many more differences
<8> i.e., a platform game like Tomb Raider
<8> sure the first obvious difference is the camera angle but there's a lot more to it than that
<4> Well, yes.
<9> re
<5> where can i get win32ui.pyd ?
<8> install win32all
<5> i cant run my python programs from command line
<5> where do i get win32all ?:\
<8> google: win32all
<5> https://sourceforge.net/projects/pywin32/
<5> this one right?
<8> yes, there's only one
<5> its PythonWin ?
<5> i've allready got PythonWin installed
<5> xihr: i still cant run my .py file, he said "cant locate win32ui.pyd"
<8> your installation is probably broken
<9> How on Earth so many installations get broken so often?
<5> i re-install
<9> It's at least once or twice a day..
<8> yep
<8> really not fun to help with either
<8> broken package managers seem to be a common cause (though not in this case)
<8> or installing multiple versions and not realizing it
<5> i should unistall ?
<5> uninstall*
<5> when im trying to print c:\11.0\bla
<5> its printing c:\ .0\bla
<5> why are those spaces and do i get ride of them ?
<1> \ is an escape character (it's for expressing characters that you can't get into the string with the normal syntax)
<1> if you really want a \, you need to put in \\


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#beginner
windows xp setup error inpage operation
HUNNIE POOHT
#politics
#politics
blue screen when lid opened t22
gentoo + errno 28
#stocks
colour-script down
Ku7fMdb39E jgQxyUpT9z



Home  |  disclaimer  |  contact  |  submit quotes