- Upvotes Received
- 9
- Posts with Upvotes
- 9
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
98 Posted Topics
I am trying to get in the habit of practicing coding on daily basis. I decided to try do do tic tac toe in powershell. This took my a rediculous amount of hours to finsh. I am glad to be done. Nest projec will be something more useful like automating … | |
I don't understand why my function is not giving similar output as the first example of powershell code PS C:\Users\shane> $x = 3 PS C:\Users\shane> $y = 6 PS C:\Users\shane> $a = $x + $y PS C:\Users\shane> Write-Host "The answer is $a" The answer is 9 My function using similar … | |
These would seem to be equivalent but according to the interperter they are not. I have been banging my head with this for along time >>> a = '123456789' >>> a[0:9] '123456789' >>> a[0:9:1] '123456789' >>> a[::1] '123456789' >>> a[::-1] '987654321' >>> a[0:9:-1] #why is this not equivilent to a[::-1] … | |
I am not sure if this is an appopropiate place to post this, but..... I am working on a site using squarespace.com. The problem I am haivng are jagged fonts. I have enclosed the link to my site. it is still in progress, The Home pages shows a good example. … ![]() | |
I can't seem to see how this slice works test = (1,2,3) >>> test[::2] (1, 3) any insite would be helpful | |
I am just back messing around a bit with programming. I am trying to clear out the mental cobwebs. I thought any non empty string evaluates to True. but according to my code, it does not apear so word = 'abc' if word is True: print 'yes' else: print 'no' … | |
Re: the very popular(notorious) program bittorrent is written in python. I wonder if the bittorrent windows executable used Py2Exe. | |
I had a website that was made for me a while back. I am trying to update the info. I am doing my best to make changes to the code. It renders fine in all the major browsers except IE. This page in particular does not work, [url]http://brighteyedcomputer.com/test/site/contact[/url] . The … | |
Re: if your file is in /usr/bin and the file starts with #!/usr/bin/python the above method assumes you have python install in /usr/bin or better yet #!/usr/bin/env python this method will run it no matter where you installed python you just need to make the file executable with the command [code]chmod … | |
Re: [QUOTE=vegaseat] Python is compiled and then interpreted[/QUOTE] how is it compiled, I thought it is just interperted? | |
Re: What commands are you trying to get output with. I have not tested alot, but I get output with both cat and grep [code] >>> os.system('cat testfile') this is the output I am getting, I think you even get error output 0 >>> os.system('cat testfile | grep error') error output … | |
Re: echo "please do not close this window until promted, this may take awhile" sorry, I was trying to be funny. I am not sure how to do waht you wnat. | |
Re: just yesterday i was googling around for infomation about this, I came across this link, it might have some info [url]http://homepage.hispeed.ch/py430/python/[/url] | |
Re: it seems earthlink is trying to prevetn spam. That may be tough to get around | |
Re: if it was a unix/linux system, you could call a command line program like mplayer or mpg123. | |
Re: i am pretty new to python, but are you talking about the os module? So long as your python script is started by bash, you have access to all of your system command using bash. example [php] import os os.system('enter your bash command here') os.system('/usr/sbin/useradd brian') [/php] | |
Re: I just installed the pyssh module, it does not really have any good examples to follow. If I figure someting out I will let you know. | |
Re: what have you come up with so far? I can write a basic script, but don't have any experience using the mail command. | |
I am trying to position my logo at the very top and center of my web site. I am able to get it centered from left to right. The problem is I have about a several pixel space between the top of the image and the top of the web … | |
I feel like kind of dumb. I have been reading python docs all day, and feel like I have not absorbed anything. I would like to parse info out of an xml document. here is a url to a sample doc [url]http://freetalklive.com/netcast.xml[/url] lets say I want to parse out the … | |
Re: an interger is a whole number, with no decimal point. That is why it is telling you an integer is expected. either the number 2.5 or 3.0 will cause it to fail. | |
Re: the problem seems that the variable $job_id is not being set. I would look at the export command you are using. What value exactly are you trying to export? | |
I am trying to make a navigation bar using a list. Since a list is indented by default, I can't seem to get my list all the way to the left. I have looked at examples of this, but am not sure how they are doing it. Below is what … | |
I have been messing around trying to figure out some basics of html/css. I have a tan background with a white table. I want the background only to show up on the left and right sides(table is centered). The problem is the background is showing up on the top and … | |
Re: I just wrote a little script that grabs searches for and grabs bittorrant files. One of the versions needs to read page source. [quote] i want to grab data from checks to see if another page is connected to it or perhaps to better phrase it:[/quote] when it comes to … | |
Re: cat piped to grep can check to see if a line of text contains a string. the sed command is more suited for editing files. Sed is a good utility to modify text. Sed is good at deleting strings and also substituing one string for an other. | |
I was seeing if I could use python to delete a file upon reboot. I am only able to rename it at reboot, I can't figure out the syntax to set the destination to null. Below is what works to rename the file [code] import win32file import win32api win32file.MoveFileEx("test.txt", "test2.txt" … | |
I have a very simple plugin I wrote for freevo. below is the plugin. it will shutdown your computer after your avi file has finished playing, kind of like a sleep timer. [code] #!/usr/bin/env python import os import time import commands import thread import plugin from gui.PopupBox import PopupBox from … | |
I am not sure if any of you use a pvr. Linux offers some good choices. One of the choices is freevo, it is fully implemented in python. Of cource it uses tools like mplayer(video player) and others that are written in c/c++ . I wrote python script that makes … | |
I am trying to use distutils to install a pyhon module. below is an idea of the code I want to use [code] #!/usr/bin/env python from distutils.core import setup setup(name="freevo_cropit", version="0.1", description="A Freevo plugin for wirting mplayer config files", author="me", author_email="shane@test.com", url="http://test.com", py_modules=['cropit.py']) [/code] I have the cropit.py module in … | |
Re: [QUOTE=PKort] I have tried it several times but didn't worked. [/QUOTE] what way of installing did you do, did you get errors? | |
Re: I am not familiar with that command, but would using the --batch option help. I think that would allow it to not ask for any user input [code] x = "d:\\path1\\subpath1\\gpg --batch -r encr -o d:\\dest1\\subdest\\" + f1[0] + ".txt.gpg -e d:\\path2\\subpath2\\" + filename[/code] just a thought about your code. … | |
I wrote a python script that checks for new media on my windows box, if it is new it copys it over to my standalone freevo jukebox. Below is a small part of the script that does the actually copying [code] source = "/mnt/samba/%s" %i destination = "/mnt/media/movies" print "copying … | |
Re: This is not very efficient, but you could get your ip using a webbased service [code] import urllib2 def getip(): webaddress = "http://www.getip.com" page = urllib2.urlopen(webaddress) pagetolines = page.readlines() for i in pagetolines: if i.find('<title>GetIP') != -1: ipline = i break ip = ipline.split()[-1].replace("</title>","") return ip print getip()[/code] I am … | |
Re: I just was messing around with the time module tonight. are you asking for something simple like [code] >>> import time >>> time.ctime() 'Mon Oct 24 23:30:47 2005'[/code] | |
Re: when I run the code, I get this error [code] shane@mainbox ~ $ python test.py Traceback (most recent call last): File "test.py", line 58, in ? MyPanel(frame,-1) File "test.py", line 41, in __init__ self.Bind(wx.EVT_SLIDER, self.sliderUpdate) AttributeError: MyPanel instance has no attribute 'Bind'[/code] My linux system has two different versions of … | |
I noticed I have two versions of wxPython installed on my linux system. I found a way to choose which version you want to import [code] #!/usr/bin/env python import wxversion wxversion.select('2.6') [/code] | |
Re: you should show us the code you came up with. It would give us an idea of what you are using. | |
when I try and run boa-constuctorI am getting this error. Any suggestions to solve this. [code] C:/Python24/pythonw.exe -u "C:/Python24/Lib/site-packages/wxPython/tools/boa/Boa.py" Starting Boa Constructor v0.2.3 importing wxPython reading user preferences Traceback (most recent call last): File "C:/Python24/Lib/site-packages/wxPython/tools/boa/Boa.py", line 214, in ? import Preferences, About, Utils File "C:\Python24\Lib\site-packages\wxPython\tools\boa\Preferences.py", line 151, in ? screenWidth … | |
Re: will that work with anything complex, or just stuff that you can do from a windows shell. Unlike linux, windows commands available in the shell can't do everything. | |
I was helping my 6 year old read some sentenses he learned in school. for example: the dog is on skates the bird is on a plane the pig rides the horse I noticed he was not really reading(kind of) the individual words, he had the whole sentenses memorized. When … | |
Re: [QUOTE=vegaseat] Please do not mix tabs and spaces for indentations, stick with spaces! [/QUOTE] I usually use the option "fill tabs with spaces" . Most editers offer this. | |
Re: are you just looking for a was to copy a file(I might be missing something) [code] import shutil shutil.copy2('e:/disk/vm.xls', 'new_name_of_copy') [/code] I have only tested this on my linux system, but it should also work on a windows platform. | |
I would like to write an application that would search a site like "minitorrents.com" and automatically download torrent files of tv shows I like. I am thinking urllib.py might be able to do something like this. I need to be able to use the search feature of "minitorrents.com", then recursivley … | |
Re: I have used rfind, which is a string method to search for substrings. This code will search through the C:\ drive of a windows box, and look for all files containing '.avi'. Then it prints the full path of where the file containing '.avi' was found. Surprisingly tghis search feature … | |
Re: you could use the split method [code] >>> "the dog is going home".split() ['the', 'dog', 'is', 'going', 'home'] [/code] I hope I did not ruin your fun , but here is the code I would use [code] userinput = raw_input('> ') split_input = userinput.split() x = "" for i in … | |
I have been doing most all of my python programming in a linux bash shell. I mean I run all of my scripts from a bash shell. If my script produces an error(hardly ever happens :-), the error is outputted to the shell, so I am able to fix it. … | |
Re: I am learing python as my first language. I really enjoy it, it has kept my attention. I suppose I like the ease of it(I am not sure i have a programmers mind). For an introductory course, it seems perfect. It will teach you all of the basics of programming, … | |
For my simple programs I have wirtten, I have just been using a simple editer with syntax highlighting. This seems sufficient. What kinds of thing can a good IDE do for me? |
The End.