Jump to content

  • Log In with Google      Sign In   
  • Create Account

Kurai Tsubasa

Member Since 22 Aug 2013
Offline Last Active Oct 11 2014 05:30 AM

#5113708 Need more than 1 value to unpack?

Posted by Kurai Tsubasa on 02 December 2013 - 04:50 AM

 

try this:



from sys import argv
for arg in argv:
 print(arg)

and you will see that there is a argv in your case

 

also you can check length of argv before unpacking



if len(argv) > 1:
 #do some code here

Thank you i will try thissmile.png 




#5112401 How to run Notepad++ script in CMD

Posted by Kurai Tsubasa on 27 November 2013 - 04:02 AM

Powershell comes bundled with many Windows version. Try executing



powershell
in a command prompt window.

 

 

 

If you have Python installed in your Windows OS, do next:

1) execute cmd.exe;

2) python ex2.py

and you have some result as with other shell environment.

 

If Python not installed, but simple unpacked, for example to c:\python27, do next:

1) execute cmd.exe;

2) c:\python27\python.exe ex2.py;

or

1) execute cmd.exe;

2) set path=%path%;c:\python27

3) python ex2.py

Thank you that really helpfulsmile.png




#5111793 How to run Notepad++ script in CMD

Posted by Kurai Tsubasa on 25 November 2013 - 04:08 AM

Without knowing what you are trying to achieve, we are all at a loss to help you.   There are things that PowerShell can do that the regular CMD shell cannot, so it's quite possible you can't achieve whatever it is you are trying to do with CMD alone.

 

If you were to at least link to the tutorial you are referring to perhaps somebody can help you.  

 

And what does this have to do with Python?

Yes this is the link http://learnpythonthehardway.org/book/ in the first tutorial they teach us to make library in powershell and second tutorial they teach us to make a "print" in notepad++ using python language.In the second tutorial we can see the python print script is tested in powershell so i don't want to use powershell but i want to use cmd.Thank you and sorry if my post is confusing you ^^a i hope this will make it clear




#5109679 How to use Class?and what is return?

Posted by Kurai Tsubasa on 16 November 2013 - 06:01 AM

Hi everyone i have a question about how to use a class so i make this script:

 

 

>>> class className:
             def createName(self,name):
                          self.name=name
             def displayName(self):
                          return self.name
             def saying(self):
                          print 'Hello %s' % self.name

 

>>> first=className

>>> first.createName('X')

 

I learn this from a tutorial but i have an error:

 

 

Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
first.createName('X')
TypeError: unbound method createName() must be called with className instance as first argument (got str instance instead)

 

 

the tutorial i watched is using 2.6 and i'm using 2.7 also what is the difference between return and print in def

 

and why i need to use (self,name) instead of only (self)

 

Thank you very much




PARTNERS