clear
vim desktop
vim list
vim houdini12.1
. current diractory
.. up diractory
cd. cd..
Vim--------------------------------------------------------------------------------
i(insert
a(append
:w(save
:q (exit
:qw
:q!
:
esc
----------------------------------------------------------------
---------------------------------------------------------------
d ---delete
x 1delete
6+x 6delete
4+d 4---delete
h left
j down
k up
l right
u undo
ctrl+r redo
w,b move
3w 3 move
5b 5 back
yy copy p paste
dd 4dd
:w :e
hangle zjtjdnlcldp english q hangle fmf snffj
ctrl-w n
ctrl-w v
:qa!
%$$ vertical mouse,emacs,google.com,,chrome korean+english
-----------------------------------------------------------------------------
python
www.python.org
document
library rference
help
----------------------------------
qt.project.org / pyqt /pyside
---------
ls -l
ll
pwd
env
ls -a
ls -s
ll
ls -l
env | grep HFS
houdini
cd /home
cd $home
cd
cd ~
env
touch abc
pwd
rm abc
pwd
ls -l >list
cat list
env | grep
-----------regular expression------------
2013년 1월 5일 토요일
2013년 1월 4일 금요일
파이썬공부
나름 정리
여러 연산
+,-,*,/,등등...
+,-,*,/,등등...
//몫 연산자,%나눈 나머지,
**지수연산자,5e10는 5의 10의 10승,
a=1+4j 실수부와 허수부 j가 붙으면 허수부
import keyword
keyword.kwlist 는 파이썬 예약어를 보여준다.
keyword.kwlist 는 파이썬 예약어를 보여준다.
#은 주석문
```
불라불라
불라불라 <이거또한 긴 문장의 주석
```
\은 다음라인을 현재라인과 연결시켜 주는 역활
=치환할 때 쓰인다. ==는 두 개의 값이 동일한지..
c ,d = 3, 4 한꺼번에 치환이 가능..
x=y=z=0 여러 개의 값을 0으로 치환
;는 문들을 구분시킬때 쓴다..
e,f=f,e은 값 교환
+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=,**=
ex)a=1
a += 4 # a=a+4
a=5
[]리스트
[0] 0번째 인덱싱
[1:5]1번째 부터 5번째 사이
[:]처음부터 끝까지
[5:]5번째 다음부터 끝까지
[:5]처음부터 5번째 미만 까지..
[::2]2간 단위로
[::-1]거꾸로
[1:5]1번째 부터 5번째 사이
[:]처음부터 끝까지
[5:]5번째 다음부터 끝까지
[:5]처음부터 5번째 미만 까지..
[::2]2간 단위로
[::-1]거꾸로
print 출력할때..
divmod( , ) 몫과 나머지
len() 갯수를 출력..
str() 은 문자열로 변화 시켜준다.
type()자료형 확인
eval()문자열로 된 식을 실행
exec()문자열로 된 문을 실행
range()입력된 숫자 전까지 다 입력한다.
*if문
if 조건식1:
<문1>
elif 조건식2:
<문2>
else 조건식3:
<문3>
----------------------
조건식 하나만 쓸 때는 if
두번 쓸 떈 if와 else
if와 else사이에 elif가 몇 개든 올 수 있다..
if 조건식1:
<문1>
elif 조건식2:
<문2>
else 조건식3:
<문3>
----------------------
조건식 하나만 쓸 때는 if
두번 쓸 떈 if와 else
if와 else사이에 elif가 몇 개든 올 수 있다..
>>> c = 15 * 5
>>> d = 15 + 15 + 15 + 15 + 15
>>> if c > d: # 만약 c가 d보다 크면
... print('c > d') # 'c > d'라고 출력한다.
... elif c == d: # 그렇지 않고 c와 d가 같다면
... print('c == d') # 'c == d'라고 출력한다.
... else: # 이도 저도 아니면
... print('c < d') # 'c < d'라고 출력한다.
...
c == d
for <타겟> in <객체>:
<문1>
else:
<문2>
---------------------------------
for문에서 반복해주고
else문은 break문으로 중단되지 않을 때 수행된다.
for문에서 break를 적어주면 반복해주지 않고 끈어준다.
for문은 중첩시켜 쓸 수 있다.
이건 일반`` 이건 문자로 출력시'' ""
2012년 12월 24일 월요일
houdin Python공부
>>> help(sys)
>>> Help on built-in module sys:
NAME
sys
FILE
(built-in)
MODULE DOCS
http://docs.python.org/library/sys
DESCRIPTION
This module provides access to some objects used or maintained by the
interpreter and to functions that interact strongly with the interpreter.
Dynamic objects:
argv -- command line arguments; argv[0] is the script pathname if known
path -- module search path; path[0] is the script directory, else ''
modules -- dictionary of loaded modules
displayhook -- called to show results in an interactive session
excepthook -- called to handle any uncaught exception other than SystemExit
To customize printing in an interactive session or to install a custom
top-level exception handler, assign other functions to replace these.
exitfunc -- if sys.exitfunc exists, this routine is called when Python exits
Assigning to sys.exitfunc is deprecated; use the atexit module instead.
stdin -- standard input file object; used by raw_input() and input()
stdout -- standard output file object; used by the print statement
stderr -- standard error object; used for error messages
By assigning other file objects (or objects that behave like files)
to these, it is possible to redirect all of the interpreter's I/O.
last_type -- type of last uncaught exception
last_value -- value of last uncaught exception
last_traceback -- traceback of last uncaught exception
These three are only available in an interactive session after a
traceback has been printed.
exc_type -- type of exception currently being handled
exc_value -- value of exception currently being handled
exc_traceback -- traceback of exception currently being handled
The function exc_info() should be used instead of these three,
because it is thread-safe.
Static objects:
maxint -- the largest supported integer (the smallest is -maxint-1)
maxsize -- the largest supported length of containers.
maxunicode -- the largest supported character
builtin_module_names -- tuple of module names built into this interpreter
version -- the version of this interpreter as a string
version_info -- version information as a tuple
hexversion -- version information encoded as a single integer
copyright -- copyright notice pertaining to this interpreter
platform -- platform identifier
executable -- pathname of this Python interpreter
prefix -- prefix used to find the Python library
exec_prefix -- prefix used to find the machine-specific Python library
dllhandle -- [Windows only] integer handle of the Python DLL
winver -- [Windows only] version number of the Python DLL
__stdin__ -- the original stdin; don't touch!
__stdout__ -- the original stdout; don't touch!
__stderr__ -- the original stderr; don't touch!
__displayhook__ -- the original displayhook; don't touch!
__excepthook__ -- the original excepthook; don't touch!
Functions:
displayhook() -- print an object to the screen, and save it in __builtin__._
excepthook() -- print an exception and its traceback to sys.stderr
exc_info() -- return thread-safe information about the current exception
exc_clear() -- clear the exception state for the current thread
exit() -- exit the interpreter by raising SystemExit
getdlopenflags() -- returns flags to be used for dlopen() calls
getprofile() -- get the global profiling function
getrefcount() -- return the reference count for an object (plus one :-)
getrecursionlimit() -- return the max recursion depth for the interpreter
getsizeof() -- return the size of an object in bytes
gettrace() -- get the global debug tracing function
setcheckinterval() -- control how often the interpreter checks for events
setdlopenflags() -- set the flags to be used for dlopen() calls
setprofile() -- set the global profiling function
setrecursionlimit() -- set the max recursion depth for the interpreter
settrace() -- set the global debug tracing function
FUNCTIONS
__displayhook__ = displayhook(...)
displayhook(object) -> None
Print an object to sys.stdout and also save it in __builtin__.
__excepthook__ = excepthook(...)
excepthook(exctype, value, traceback) -> None
Handle an exception by displaying it with a traceback on sys.stderr.
call_tracing(...)
call_tracing(func, args) -> object
Call func(*args), while tracing is enabled. The tracing state is
saved, and restored afterwards. This is intended to be called from
a debugger from a checkpoint, to recursively debug some other code.
callstats(...)
callstats() -> tuple of integers
Return a tuple of function call statistics, if CALL_PROFILE was defined
when Python was built. Otherwise, return None.
When enabled, this function returns detailed, implementation-specific
details about the number of function calls executed. The return value is
a 11-tuple where the entries in the tuple are counts of:
0. all function calls
1. calls to PyFunction_Type objects
2. PyFunction calls that do not create an argument tuple
3. PyFunction calls that do not create an argument tuple
and bypass PyEval_EvalCodeEx()
4. PyMethod calls
5. PyMethod calls on bound methods
6. PyType calls
7. PyCFunction calls
8. generator calls
9. All other calls
10. Number of stack pops performed by call_function()
displayhook(...)
displayhook(object) -> None
Print an object to sys.stdout and also save it in __builtin__.
exc_clear(...)
exc_clear() -> None
Clear global information on the current exception. Subsequent calls to
exc_info() will return (None,None,None) until another exception is raised
in the current thread or the execution stack returns to a frame where
another exception is being handled.
exc_info(...)
exc_info() -> (type, value, traceback)
Return information about the most recent exception caught by an except
clause in the current stack frame or in an older stack frame.
excepthook(...)
excepthook(exctype, value, traceback) -> None
Handle an exception by displaying it with a traceback on sys.stderr.
exit(...)
exit([status])
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
getcheckinterval(...)
getcheckinterval() -> current check interval; see setcheckinterval().
getdefaultencoding(...)
getdefaultencoding() -> string
Return the current default string encoding used by the Unicode
implementation.
getfilesystemencoding(...)
getfilesystemencoding() -> string
Return the encoding used to convert Unicode filenames in
operating system filenames.
getprofile(...)
getprofile()
Return the profiling function set with sys.setprofile.
See the profiler chapter in the library manual.
getrecursionlimit(...)
getrecursionlimit()
Return the current value of the recursion limit, the maximum depth
of the Python interpreter stack. This limit prevents infinite
recursion from causing an overflow of the C stack and crashing Python.
getrefcount(...)
getrefcount(object) -> integer
Return the reference count of object. The count returned is generally
one higher than you might expect, because it includes the (temporary)
reference as an argument to getrefcount().
getsizeof(...)
getsizeof(object, default) -> int
Return the size of object in bytes.
gettrace(...)
gettrace()
Return the global debug tracing function set with sys.settrace.
See the debugger chapter in the library manual.
getwindowsversion(...)
getwindowsversion()
Return information about the running version of Windows.
The result is a tuple of (major, minor, build, platform, text)
All elements are numbers, except text which is a string.
Platform may be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP
setcheckinterval(...)
setcheckinterval(n)
Tell the Python interpreter to check for asynchronous events every
n instructions. This also affects how often thread switches occur.
setprofile(...)
setprofile(function)
Set the profiling function. It will be called on each function call
and return. See the profiler chapter in the library manual.
setrecursionlimit(...)
setrecursionlimit(n)
Set the maximum depth of the Python interpreter stack to n. This
limit prevents infinite recursion from causing an overflow of the C
stack and crashing Python. The highest possible limit is platform-
dependent.
settrace(...)
settrace(function)
Set the global debug tracing function. It will be called on each
function call. See the debugger chapter in the library manual.
DATA
__stderr__ = <open file '<stderr>', mode 'w' at 0x0000000017FFC1C8>
__stdin__ = <open file '<stdin>', mode 'r' at 0x0000000017FFC0B8>
__stdout__ = <open file '<stdout>', mode 'w' at 0x0000000017FFC140>
api_version = 1013
argv = ['']
builtin_module_names = ('__builtin__', '__main__', '_ast', '_bisect', ...
byteorder = 'little'
copyright = 'Copyright (c) 2001-2009 Python Software Foundati...ematis...
dllhandle = 503316480L
dont_write_bytecode = False
exc_value = TypeError('arg is a built-in module',)
exec_prefix = 'C:/PROGRA~1/SIDEEF~1/HOUDIN~1.572/python26'
executable = r'C:\Program Files\Side Effects Software\Houdini 12.0.572...
flags = sys.flags(debug=0, py3k_warning=0, division_warn...abcheck=0, ...
float_info = sys.floatinfo(max=1.7976931348623157e+308, max_e...psilon...
hexversion = 33948912
last_value = SyntaxError('invalid syntax', ('<console>', 3, 1, 'r\n'))
maxint = 2147483647
maxsize = 9223372036854775807L
maxunicode = 65535
meta_path = []
modules = {'StringIO': <module 'StringIO' from 'C:\PROGRA~1\SIDEEF~1\H...
path = ['', r'C:\PROGRA~1\SIDEEF~1\HOUDIN~1.572\python26\python26.zip'...
path_hooks = [<type 'zipimport.zipimporter'>]
path_importer_cache = {'': None, 'C:/PROGRA~1/SIDEEF~1/HOUDIN~1.572/ho...
platform = 'win32'
prefix = 'C:/PROGRA~1/SIDEEF~1/HOUDIN~1.572/python26'
ps1 = '>>> '
ps2 = '... '
py3kwarning = False
stderr = <hou.ShellIO; proxy of <Swig Object of type 'HOM_ShellIO *' a...
stdin = <hou.ShellIO; proxy of <Swig Object of type 'HOM_ShellIO *' at...
stdout = <hou.ShellIO; proxy of <Swig Object of type 'HOM_ShellIO *' a...
subversion = ('CPython', 'tags/r264', '75706')
version = '2.6.4 (r264:75706, Feb 9 2012, 11:53:18) [MSC v.1500 64 bi...
version_info = (2, 6, 4, 'final', 0)
warnoptions = []
winver = '2.6'
>>>
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help(string)
>>> Help on module string:
NAME
string - A collection of string operations (most are no longer used).
FILE
c:\progra~1\sideef~1\houdin~1.572\python26\lib\string.py
DESCRIPTION
Warning: most of the code you see here isn't normally used nowadays.
Beginning with Python 1.6, many of these functions are implemented as
methods on the standard string object. They used to be implemented by
a built-in module called strop, but strop is now obsolete itself.
Public module variables:
whitespace -- a string containing all characters considered whitespace
lowercase -- a string containing all characters considered lowercase letters
uppercase -- a string containing all characters considered uppercase letters
letters -- a string containing all characters considered letters
digits -- a string containing all characters considered decimal digits
hexdigits -- a string containing all characters considered hexadecimal digits
octdigits -- a string containing all characters considered octal digits
punctuation -- a string containing all characters considered punctuation
printable -- a string containing all characters considered printable
CLASSES
__builtin__.object
Formatter
Template
class Formatter(__builtin__.object)
| Methods defined here:
|
| check_unused_args(self, used_args, args, kwargs)
|
| convert_field(self, value, conversion)
|
| format(self, format_string, *args, **kwargs)
|
| format_field(self, value, format_spec)
|
| get_field(self, field_name, args, kwargs)
| # given a field_name, find the object it references.
| # field_name: the field being looked up, e.g. "0.name"
| # or "lookup[3]"
| # used_args: a set of which args have been used
| # args, kwargs: as passed in to vformat
|
| get_value(self, key, args, kwargs)
|
| parse(self, format_string)
| # returns an iterable that contains tuples of the form:
| # (literal_text, field_name, format_spec, conversion)
| # literal_text can be zero length
| # field_name can be None, in which case there's no
| # object to format and output
| # if field_name is not None, it is looked up, formatted
| # with format_spec and conversion and then used
|
| vformat(self, format_string, args, kwargs)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class Template(__builtin__.object)
| A string class for supporting $-substitutions.
|
| Methods defined here:
|
| __init__(self, template)
|
| safe_substitute(self, *args, **kws)
|
| substitute(self, *args, **kws)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __metaclass__ = <class 'string._TemplateMetaclass'>
|
|
| delimiter = '$'
|
| idpattern = '[_a-z][_a-z0-9]*'
|
| pattern = <_sre.SRE_Pattern object at 0x00000000186C22B0>
FUNCTIONS
atof(s)
atof(s) -> float
Return the floating point number represented by the string s.
atoi(s, base=10)
atoi(s [,base]) -> int
Return the integer represented by the string s in the given
base, which defaults to 10. The string s must consist of one
or more digits, possibly preceded by a sign. If base is 0, it
is chosen from the leading characters of s, 0 for octal, 0x or
0X for hexadecimal. If base is 16, a preceding 0x or 0X is
accepted.
atol(s, base=10)
atol(s [,base]) -> long
Return the long integer represented by the string s in the
given base, which defaults to 10. The string s must consist
of one or more digits, possibly preceded by a sign. If base
is 0, it is chosen from the leading characters of s, 0 for
octal, 0x or 0X for hexadecimal. If base is 16, a preceding
0x or 0X is accepted. A trailing L or l is not accepted,
unless base is 0.
capitalize(s)
capitalize(s) -> string
Return a copy of the string s with only its first character
capitalized.
capwords(s, sep=None)
capwords(s [,sep]) -> string
Split the argument into words using split, capitalize each
word using capitalize, and join the capitalized words using
join. If the optional second argument sep is absent or None,
runs of whitespace characters are replaced by a single space
and leading and trailing whitespace are removed, otherwise
sep is used to split and join the words.
center(s, width, *args)
center(s, width[, fillchar]) -> string
Return a center version of s, in a field of the specified
width. padded with spaces as needed. The string is never
truncated. If specified the fillchar is used instead of spaces.
count(s, *args)
count(s, sub[, start[,end]]) -> int
Return the number of occurrences of substring sub in string
s[start:end]. Optional arguments start and end are
interpreted as in slice notation.
expandtabs(s, tabsize=8)
expandtabs(s [,tabsize]) -> string
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default 8).
find(s, *args)
find(s, sub [,start [,end]]) -> in
Return the lowest index in s where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
index(s, *args)
index(s, sub [,start [,end]]) -> int
Like find but raises ValueError when the substring is not found.
join(words, sep=' ')
join(list [,sep]) -> string
Return a string composed of the words in list, with
intervening occurrences of sep. The default separator is a
single space.
(joinfields and join are synonymous)
joinfields = join(words, sep=' ')
join(list [,sep]) -> string
Return a string composed of the words in list, with
intervening occurrences of sep. The default separator is a
single space.
(joinfields and join are synonymous)
ljust(s, width, *args)
ljust(s, width[, fillchar]) -> string
Return a left-justified version of s, in a field of the
specified width, padded with spaces as needed. The string is
never truncated. If specified the fillchar is used instead of spaces.
lower(s)
lower(s) -> string
Return a copy of the string s converted to lowercase.
lstrip(s, chars=None)
lstrip(s [,chars]) -> string
Return a copy of the string s with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
maketrans(...)
maketrans(frm, to) -> string
Return a translation table (a string of 256 bytes long)
suitable for use in string.translate. The strings frm and to
must be of the same length.
replace(s, old, new, maxsplit=-1)
replace (str, old, new[, maxsplit]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
rfind(s, *args)
rfind(s, sub [,start [,end]]) -> int
Return the highest index in s where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
rindex(s, *args)
rindex(s, sub [,start [,end]]) -> int
Like rfind but raises ValueError when the substring is not found.
rjust(s, width, *args)
rjust(s, width[, fillchar]) -> string
Return a right-justified version of s, in a field of the
specified width, padded with spaces as needed. The string is
never truncated. If specified the fillchar is used instead of spaces.
rsplit(s, sep=None, maxsplit=-1)
rsplit(s [,sep [,maxsplit]]) -> list of strings
Return a list of the words in the string s, using sep as the
delimiter string, starting at the end of the string and working
to the front. If maxsplit is given, at most maxsplit splits are
done. If sep is not specified or is None, any whitespace string
is a separator.
rstrip(s, chars=None)
rstrip(s [,chars]) -> string
Return a copy of the string s with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
split(s, sep=None, maxsplit=-1)
split(s [,sep [,maxsplit]]) -> list of strings
Return a list of the words in the string s, using sep as the
delimiter string. If maxsplit is given, splits at no more than
maxsplit places (resulting in at most maxsplit+1 words). If sep
is not specified or is None, any whitespace string is a separator.
(split and splitfields are synonymous)
splitfields = split(s, sep=None, maxsplit=-1)
split(s [,sep [,maxsplit]]) -> list of strings
Return a list of the words in the string s, using sep as the
delimiter string. If maxsplit is given, splits at no more than
maxsplit places (resulting in at most maxsplit+1 words). If sep
is not specified or is None, any whitespace string is a separator.
(split and splitfields are synonymous)
strip(s, chars=None)
strip(s [,chars]) -> string
Return a copy of the string s with leading and trailing
whitespace removed.
If chars is given and not None, remove characters in chars instead.
If chars is unicode, S will be converted to unicode before stripping.
swapcase(s)
swapcase(s) -> string
Return a copy of the string s with upper case characters
converted to lowercase and vice versa.
translate(s, table, deletions='')
translate(s,table [,deletions]) -> string
Return a copy of the string s, where all characters occurring
in the optional argument deletions are removed, and the
remaining characters have been mapped through the given
translation table, which must be a string of length 256. The
deletions argument is not allowed for Unicode strings.
upper(s)
upper(s) -> string
Return a copy of the string s converted to uppercase.
zfill(x, width)
zfill(x, width) -> string
Pad a numeric string x with zeros on the left, to fill a field
of the specified width. The string x is never truncated.
DATA
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
>>> help(os)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'os' is not defined
>>> help(type)
Help on class type in module __builtin__:
class type(object)
| type(object) -> the object's type
| type(name, bases, dict) -> a new type
|
| Methods defined here:
|
| __call__(...)
| x.__call__(...) <==> x(...)
|
| __cmp__(...)
| x.__cmp__(y) <==> cmp(x,y)
|
| __delattr__(...)
| x.__delattr__('name') <==> del x.name
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __gt__(...)
| x.__gt__(y) <==> x>y
|
| __hash__(...)
| x.__hash__() <==> hash(x)
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| __le__(...)
| x.__le__(y) <==> x<=y
|
| __lt__(...)
| x.__lt__(y) <==> x<y
|
| __ne__(...)
| x.__ne__(y) <==> x!=y
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __setattr__(...)
| x.__setattr__('name', value) <==> x.name = value
|
| __subclasses__(...)
| __subclasses__() -> list of immediate subclasses
|
| mro(...)
| mro() -> list
| return a type's method resolution order
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __abstractmethods__
|
| __base__
|
| __bases__
|
| __basicsize__
|
| __dict__
|
| __dictoffset__
|
| __flags__
|
| __instancecheck__
|
| __itemsize__
|
| __mro__
|
| __subclasscheck__
|
| __weakrefoffset__
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object at 0x000000001E2687D...
| T.__new__(S, ...) -> a new object with type S, a subtype of T
2012년 12월 22일 토요일
파이썬강의
# a=1 입력이 된다
# a ==1은 같다
'''
>=
'''
a = range(10)
result=0
firstS=str(a[0])
endS=str(a[len(a)-1])
end = len(a)-1
for i in a:
result=result+i
if i == end:
print `firstS`+"plus"+`endS`+" "+"is" + `result`+`type(firstS)`+`type(endS)`
# a ==1은 같다
'''
>=
'''
a = range(10)
result=0
firstS=str(a[0])
endS=str(a[len(a)-1])
end = len(a)-1
for i in a:
result=result+i
if i == end:
print `firstS`+"plus"+`endS`+" "+"is" + `result`+`type(firstS)`+`type(endS)`
2012년 12월 20일 목요일
파이썬수업
리눅스
ls
ll
pwd
ls -al
cd 디렉토리명
cat 파일이름.py
(ex: cat p(tab키 누르면 자동 완성))(.py파일 실행)
chmod +x 파일이름.py 를 하면 py파일을 실행 파일로 바꿔준다.
./파일이름.py 아니면 전체경로/파일이름.py
ls
ll
pwd
ls -al
cd 디렉토리명
cat 파일이름.py
(ex: cat p(tab키 누르면 자동 완성))(.py파일 실행)
chmod +x 파일이름.py 를 하면 py파일을 실행 파일로 바꿔준다.
./파일이름.py 아니면 전체경로/파일이름.py
리눅스 cd 명령어 사용법
| 1. 기능 Change Directory. 현재 작업하는 디렉토리를 변경한다. 2. 문법 # cd 디렉토리 3. 옵션 . : 현재 디렉토리 .. : 상위 디렉토리 ~ : 홈디렉토리 - : 이전 디렉토리로 이동 4. 사용방법 및 정보 디렉토리 이름과 cd 명령 사이에 반드시 공백이 있어야 한다. 디렉토리 이름을 주지 않고 수행하면 사용자의 홈 디렉토리로 이동한다. 자신이 이동하고자 하는 디렉토리는 자신에게 실행 권한(execution permission)이 있어야 한다. 실행 결과는 ‘pwd’ 명령을 통해 확인할 수 있다.
| |
2012년 12월 10일 월요일
Linux에서 Python 설치
Linux에서 Python 설치
Linux에는 기본적으로 Python이 설치되어있지만, 버젼이 맞지않을경우에 특별한 버젼의 파이썬을 다운로드하고 설치를 해야합니다.
1. Python 실행 파일 위치 및 버젼 알기
http://psjin14.tistory.com&embedCodeSrc=http%3A%2F%2Fpsjin14.tistory.com%2Fplugin%2FCallBack_bootstrapper%3F%26src%3Dhttp%3A%2F%2Fs1.daumcdn.net%2Fcfs.tistory%2Fv%2F0%2Fblog%2Fplugins%2FCallBack%2Fcallback%26id%3D7%26callbackId%3Dpsjin14tistorycom79857%26destDocId%3Dcallbacknestpsjin14tistorycom79857%26host%3Dhttp%3A%2F%2Fpsjin14.tistory.com%26float%3Dleft" swliveconnect="true">
which python --> /usr/bin/python
python -V --> 3.2.x
python -V --> 3.2.x
2. 설치하고 싶은 버젼의 tar 파일을 Linux 컴퓨터에 저장(http://python.org/download/)
3. tar 파일 압축 풀기
tar -zxvf Python-2.7.3.tar
http://psjin14.tistory.com&embedCodeSrc=http%3A%2F%2Fpsjin14.tistory.com%2Fplugin%2FCallBack_bootstrapper%3F%26src%3Dhttp%3A%2F%2Fs1.daumcdn.net%2Fcfs.tistory%2Fv%2F0%2Fblog%2Fplugins%2FCallBack%2Fcallback%26id%3D7%26callbackId%3Dpsjin14tistorycom79857%26destDocId%3Dcallbacknestpsjin14tistorycom79857%26host%3Dhttp%3A%2F%2Fpsjin14.tistory.com%26float%3Dleft" swliveconnect="true">
4. Python 설치
압축 해제된 폴더 내에서, 다음 명령어를 실행한다.
1) ./configure
2) make
3) make install
2) make
3) make install
코드를 컴파일하고, 설치를 한다.
5. Symbolic Link를 통해 원하는 버젼의 파이썬을 링크를 걸어줘야 한다.
1) 기존의 /usr/bin/python는 지워준다.
ex) sudo rm /usr/bin/python
2) Symbolic Link 걸기
ln -s /usr/bin/Python2.7 /usr/bin/python
2012년 11월 5일 월요일
MAYA Python
MAYA PYTHON
-------------------------------------------------------------------------
print u'하이 MAYA'
#유니코드를 사용하기 때문에 앞에 u를 붙인다.
import sys
print sys.version
을 치면 버전 정보가 print된다.
a=1 을 치고 a를 치면 1이 뜬다.
하지만
a=1
a
를 치게 되면, 그냥
a=1
a
가 뜬다. 왜냐하면, 한줄 이상을 입력하게 되면 대화형이 아닌 script모드로 바로 전환되기 때문이다. 그래서 a값이 바로 반환되지는 않는다..
아니면 원하는 부분만 블록 지정을 한뒤, execute를 실행해도 된다.
-Python Module Path 확인/추가하기
import sys
print sys.path
그럼 시스템경로가 print된다.
만약 c:\\myModle이라는 폴더에 python스크립트가 있으면,
import sys
sys.path.append('c:\\myModule\\')
로 경로를 추가한다..
-import maya.cmds as cmds
import maya.cmds as cmds
print cmds.ls( selection=True )
를 치면 선택한 obj가 프린트가 된다.
as 처럼...,~~로써
maya.cmds라는 module을 cmds라는 이름으로 불러오는 명령..
즉, maya.cmds라는 명령을 cmds로 바꿔서 명령을 수행하게 된다..
import maya.cmds as cmds
maya.cmds를 자주 쓰기 때문에, cmds로 짧게 바꾼 것 뿐이다..
따라서import maya.cmds as m을 쓰면
import maya.cmds as m
print m.ls( selection=True )
를 치면 똑같이 프린트가 된다.
그리고 import를 한 번만 읽어도 게속 사용이 가능하다..즉,
cmds.ls(selection=True)
m.ls( selection=True )
를 치면 똑같이 선택된 obj를 보여준다.
하지만
cmds.ls(selection=True)
cmds.ls(selection=True)
두번을 똑같은걸 치면
보이지 않는다. 왜냐하면 대화형 모드와 script모드의 차이 때문이다..
-select,wildcard
nurbsCone obj를 그리드에 맞춰 25개를 만든다.
import maya.cmds as cmds
cmds.select(all=True)
를 치면 전체가 선택이 된다.
cmds.select('*')
를 치면 결과는 똑같다.
cmds.select('nurbsCone1?')
를 치면 10~19까지 Cone이 선택된다.
cmds.select('nurbsCone1', 'nurbsCone2','nurbsCone3')
적힌 nurbsCone만 선택이 된다.
sel_obj = cmds.ls(sl=1)
cmds.select(clear=1)
를 치면 sel_obj라는 변수에 select된 목록 자료를 담고, 현재 select를 해제하였습니다.
sel_obj = cmds.ls(sl=1)명령은 sel_obj에 지금 선택한 목록을 저장하라는 명령니 된다.
sl=1은 sl=True와 같다.(python command에서 ls를 검색)(ls의 sl차입이 boolean이라서..)
sel_obj
를 치면 선택했던 obj이름이 뜬다.
obj왜에 node들도 가능하다..
-Python Sequence자료 다루기
노드나, 오브젝트를 선택
import maya.cmds as cmds
sel_=cmds.ls(sl=1)
를 치면 sle_이라는 변수에 선택된 노드를 저장한다.
sel_
를 치면 선택된 이름들이 리스트형으로 나온다.
cmds.select(sel_[0])
를 치면 0번째 node가 선택이 된다. 인덱싱.리스트자료에서 0번째
cmds.select(sel_[-1])
를 치면 마지막 node가 선택
cmds.select(sel_[:10])
를 치면 앞에서 부터 10개만 선택이 된다.
cmds.select(sel_[-10:])
를 치면 뒤에서부터 10개 선택이 된다.
cmds.select(sel_[5:15])
를 치면 5번째 부터 15번째 까지 선택
cmds.select(sel_[::2])
를 치면 한칸씩 건너뛰면서 선택
-Python Sequence자료 다루기-2
len(sel_)
를 치면 len모듈을 쳤기 때문에 자료의 계수 숫자가 나온다.
sel_.count('nurbsCone14')
를 치면 nurbsCone14의 계수를 보여준다.
sel_.index('nurbsCone14')
를 치면 리스트 자료상에서 몇번째에 있는지 알 수 있다.
sel_.remove('nurbsCone14')
를 치면 nurbsCone14가 지워진다.sel_을 쳐서 확인
del sel_[3]
를 치면 리스트 자료 중에 3번째가 지워진다.
sel_.append(u'nurbsCone14')
sel_
를 치면 append모듈로 sel_리스트에 'NURBSCone14'를 추가한다.
sel_.insert(3, u'nurbsCone14')
sel_
를 치면 3위치에 삽입이 된다.
sel_.count('nurbsCone14')
를 치면 nurbsCone14의 계수가 나온다.
sel_[3:3] = [u'nurbsCone14']
sel_
를 치면 3:3인덱싱 위치에 삽입한다.
sel_+= [u'nurbsCone14']
sel_
를 쳐도 삽입이 된다.
sel_.sort()
를 치면 이름 순서대로 리스트를 정리 한다.
sel_.reverse()
sel_
를 치면 reverse()모듈를 이용해 리스트의 순서를 반전 시킨다.
sel_.extend([u'노드',u'노드',u'노드',u'노드'들....])
sel_
를 치면 자료와 자료를 합친다.
sel_ +=[u'노드',u'노드',u'노드',u'노드'들....]
를 치면 이 역시 자료와 자료를 합친다.
sel_
'nurbsCone18' in sel_
를 치면 sel_변수안에 'nurbsCone18'가 있는지 검사
-------------------------------------------------------------------------
print u'하이 MAYA'
#유니코드를 사용하기 때문에 앞에 u를 붙인다.
import sys
print sys.version
을 치면 버전 정보가 print된다.
a=1 을 치고 a를 치면 1이 뜬다.
하지만
a=1
a
를 치게 되면, 그냥
a=1
a
가 뜬다. 왜냐하면, 한줄 이상을 입력하게 되면 대화형이 아닌 script모드로 바로 전환되기 때문이다. 그래서 a값이 바로 반환되지는 않는다..
아니면 원하는 부분만 블록 지정을 한뒤, execute를 실행해도 된다.
-Python Module Path 확인/추가하기
import sys
print sys.path
그럼 시스템경로가 print된다.
만약 c:\\myModle이라는 폴더에 python스크립트가 있으면,
import sys
sys.path.append('c:\\myModule\\')
로 경로를 추가한다..
-import maya.cmds as cmds
import maya.cmds as cmds
print cmds.ls( selection=True )
를 치면 선택한 obj가 프린트가 된다.
as 처럼...,~~로써
maya.cmds라는 module을 cmds라는 이름으로 불러오는 명령..
즉, maya.cmds라는 명령을 cmds로 바꿔서 명령을 수행하게 된다..
import maya.cmds as cmds
maya.cmds를 자주 쓰기 때문에, cmds로 짧게 바꾼 것 뿐이다..
따라서import maya.cmds as m을 쓰면
import maya.cmds as m
print m.ls( selection=True )
를 치면 똑같이 프린트가 된다.
그리고 import를 한 번만 읽어도 게속 사용이 가능하다..즉,
cmds.ls(selection=True)
m.ls( selection=True )
를 치면 똑같이 선택된 obj를 보여준다.
하지만
cmds.ls(selection=True)
cmds.ls(selection=True)
두번을 똑같은걸 치면
보이지 않는다. 왜냐하면 대화형 모드와 script모드의 차이 때문이다..
-select,wildcard
nurbsCone obj를 그리드에 맞춰 25개를 만든다.
import maya.cmds as cmds
cmds.select(all=True)
를 치면 전체가 선택이 된다.
cmds.select('*')
를 치면 결과는 똑같다.
cmds.select('nurbsCone1?')
를 치면 10~19까지 Cone이 선택된다.
cmds.select('nurbsCone1', 'nurbsCone2','nurbsCone3')
적힌 nurbsCone만 선택이 된다.
sel_obj = cmds.ls(sl=1)
cmds.select(clear=1)
를 치면 sel_obj라는 변수에 select된 목록 자료를 담고, 현재 select를 해제하였습니다.
sel_obj = cmds.ls(sl=1)명령은 sel_obj에 지금 선택한 목록을 저장하라는 명령니 된다.
sl=1은 sl=True와 같다.(python command에서 ls를 검색)(ls의 sl차입이 boolean이라서..)
sel_obj
를 치면 선택했던 obj이름이 뜬다.
obj왜에 node들도 가능하다..
-Python Sequence자료 다루기
노드나, 오브젝트를 선택
import maya.cmds as cmds
sel_=cmds.ls(sl=1)
를 치면 sle_이라는 변수에 선택된 노드를 저장한다.
sel_
를 치면 선택된 이름들이 리스트형으로 나온다.
cmds.select(sel_[0])
를 치면 0번째 node가 선택이 된다. 인덱싱.리스트자료에서 0번째
cmds.select(sel_[-1])
를 치면 마지막 node가 선택
cmds.select(sel_[:10])
를 치면 앞에서 부터 10개만 선택이 된다.
cmds.select(sel_[-10:])
를 치면 뒤에서부터 10개 선택이 된다.
cmds.select(sel_[5:15])
를 치면 5번째 부터 15번째 까지 선택
cmds.select(sel_[::2])
를 치면 한칸씩 건너뛰면서 선택
-Python Sequence자료 다루기-2
len(sel_)
를 치면 len모듈을 쳤기 때문에 자료의 계수 숫자가 나온다.
sel_.count('nurbsCone14')
를 치면 nurbsCone14의 계수를 보여준다.
sel_.index('nurbsCone14')
를 치면 리스트 자료상에서 몇번째에 있는지 알 수 있다.
sel_.remove('nurbsCone14')
를 치면 nurbsCone14가 지워진다.sel_을 쳐서 확인
del sel_[3]
를 치면 리스트 자료 중에 3번째가 지워진다.
sel_.append(u'nurbsCone14')
sel_
를 치면 append모듈로 sel_리스트에 'NURBSCone14'를 추가한다.
sel_.insert(3, u'nurbsCone14')
sel_
를 치면 3위치에 삽입이 된다.
sel_.count('nurbsCone14')
를 치면 nurbsCone14의 계수가 나온다.
sel_[3:3] = [u'nurbsCone14']
sel_
를 치면 3:3인덱싱 위치에 삽입한다.
sel_+= [u'nurbsCone14']
sel_
를 쳐도 삽입이 된다.
sel_.sort()
를 치면 이름 순서대로 리스트를 정리 한다.
sel_.reverse()
sel_
를 치면 reverse()모듈를 이용해 리스트의 순서를 반전 시킨다.
sel_.extend([u'노드',u'노드',u'노드',u'노드'들....])
sel_
를 치면 자료와 자료를 합친다.
sel_ +=[u'노드',u'노드',u'노드',u'노드'들....]
를 치면 이 역시 자료와 자료를 합친다.
sel_
'nurbsCone18' in sel_
를 치면 sel_변수안에 'nurbsCone18'가 있는지 검사
2012년 11월 4일 일요일
python기초
>>>#+,-,/,//,9/5,9.0/5.0, #등등 여러 계산이 계산기 처럼 손쉽게 가능하다..
>>>#--------------------------------------------------------------------------------
>>>-9/5
-2
>>>#확인
>>>5*(-2)+1 #젯수*몫+나머지
>>>9%5 #9를 5로 나눈 나머지
4
>>>#-------------------------------------------------------------------------------
>>>#몫과 나머지를 한꺼번에 계산
>>>divmod(9, 5)
(1, 4)
>>>a, b = divmod(9, 5)
>>>a
1
>>>b
4
>>>#---------------------------------------------------------
>>>9.0/5.0
1.8
>>>9/5.
1.8
>>>#---------------------------------------------------------------------
>>>5.
5.0
>>>5.0
5.0
>>>5.4e10 #5 곱하기 10의 10승
540000000000.0
------------------------------------------------------------------------
나름 정리
여러 연산
+,-,*,/,등등...
//몫 연산자,%나눈 나머지,
**지수연산자,5e10는 5의 10의 10승,
a=1+4j 실수부와 허수부 j가 붙으면 허수부
import keyword
keyword.kwlist 는 파이썬 예약어를 보여준다.
#은 주석문
```
불라불라
불라불라 <이거또한 긴 문장의 주석
```
\은 다음라인을 현재라인과 연결시켜 주는 역활
=치환할 때 쓰인다. ==는 두 개의 값이 동일한지..
c ,d = 3, 4 한꺼번에 치환이 가능..
x=y=z=0 여러 개의 값을 0으로 치환
;는 문들을 구분시킬때 쓴다..
e,f=f,e은 값 교환
+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=,**=
ex)a=1
a += 4 # a=a+4
a=5
[]리스트
[0] 0번째 인덱싱
[1:5]1번째 부터 5번째 사이
[:]처음부터 끝까지
[5:]5번째 다음부터 끝까지
[:5]처음부터 5번째 미만 까지..
[::2]2간 단위로
[::-1]거꾸로
print 출력할때..
divmod( , ) 몫과 나머지
len() 갯수를 출력..
str() 은 문자열로 변화 시켜준다.
type()자료형 확인
eval()문자열로 된 식을 실행
exec()문자열로 된 문을 실행
range()입력된 숫자 전까지 다 입력한다.
*if문
if 조건식1:
<문1>
elif 조건식2:
<문2>
else 조건식3:
<문3>
----------------------
조건식 하나만 쓸 때는 if
두번 쓸 떈 if와 else
if와 else사이에 elif가 몇 개든 올 수 있다..
*for문
for <타겟> in <객체>:
<문1>
else:
<문2>
---------------------------------
for문에서 반복해주고
else문은 break문으로 중단되지 않을 때 수행된다.
for문에서 break를 적어주면 반복해주지 않고 끈어준다.
for문은 중첩시켜 쓸 수 있다.
이건 일반`` 이건 문자로 출력시'' ""
--------------------------------------------------------------------------------
>>>#--------------------------------------------------------------------------------
>>>-9/5
-2
>>>#확인
>>>5*(-2)+1 #젯수*몫+나머지
>>>9%5 #9를 5로 나눈 나머지
4
>>>#-------------------------------------------------------------------------------
>>>#몫과 나머지를 한꺼번에 계산
>>>divmod(9, 5)
(1, 4)
>>>a, b = divmod(9, 5)
>>>a
1
>>>b
4
>>>#---------------------------------------------------------
>>>9.0/5.0
1.8
>>>9/5.
1.8
>>>#---------------------------------------------------------------------
>>>5.
5.0
>>>5.0
5.0
>>>5.4e10 #5 곱하기 10의 10승
540000000000.0
------------------------------------------------------------------------
나름 정리
여러 연산
+,-,*,/,등등...
//몫 연산자,%나눈 나머지,
**지수연산자,5e10는 5의 10의 10승,
a=1+4j 실수부와 허수부 j가 붙으면 허수부
import keyword
keyword.kwlist 는 파이썬 예약어를 보여준다.
#은 주석문
```
불라불라
불라불라 <이거또한 긴 문장의 주석
```
\은 다음라인을 현재라인과 연결시켜 주는 역활
=치환할 때 쓰인다. ==는 두 개의 값이 동일한지..
c ,d = 3, 4 한꺼번에 치환이 가능..
x=y=z=0 여러 개의 값을 0으로 치환
;는 문들을 구분시킬때 쓴다..
e,f=f,e은 값 교환
+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=,**=
ex)a=1
a += 4 # a=a+4
a=5
[]리스트
[0] 0번째 인덱싱
[1:5]1번째 부터 5번째 사이
[:]처음부터 끝까지
[5:]5번째 다음부터 끝까지
[:5]처음부터 5번째 미만 까지..
[::2]2간 단위로
[::-1]거꾸로
print 출력할때..
divmod( , ) 몫과 나머지
len() 갯수를 출력..
str() 은 문자열로 변화 시켜준다.
type()자료형 확인
eval()문자열로 된 식을 실행
exec()문자열로 된 문을 실행
range()입력된 숫자 전까지 다 입력한다.
*if문
if 조건식1:
<문1>
elif 조건식2:
<문2>
else 조건식3:
<문3>
----------------------
조건식 하나만 쓸 때는 if
두번 쓸 떈 if와 else
if와 else사이에 elif가 몇 개든 올 수 있다..
*for문
for <타겟> in <객체>:
<문1>
else:
<문2>
---------------------------------
for문에서 반복해주고
else문은 break문으로 중단되지 않을 때 수행된다.
for문에서 break를 적어주면 반복해주지 않고 끈어준다.
for문은 중첩시켜 쓸 수 있다.
이건 일반`` 이건 문자로 출력시'' ""
--------------------------------------------------------------------------------
피드 구독하기:
글 (Atom)