This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# help()で出てこない関数(メソッド)の引数を調べる方法。 | |
# import inspect | |
# inspect.getargspec(関数) | |
# (['self', 'arg0', 'arg1'], 'args', 'kwargs', (None,)) | |
import inspect | |
inspect.getargspec(sss) | |
print(u'test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 多次元リストを一次元にする | |
import itertools | |
l_2d = [[0, 1], [2, 3]] | |
print(list(itertools.chain.from_iterable(l_2d))) | |
# [0, 1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OrderedDictを使用して、 | |
# 例えば、 | |
# ```python | |
# iniFileParam = {'geo_iFP': 'geometry', | |
# 'txtFldA_iFP': 'txtFldA_QLineEditWid', | |
# 'rbtnD_iFP': 'rbtnD_QRadioButton' | |
# } | |
# ``` | |
# のような辞書の順番の番号で、keyやvalueを取得する方法は? | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 以下は同等である | |
print([index for index in objs]) | |
for index in objs: | |
print(index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
参考サイトは以下 | |
https://qiita.com/gold-kou/items/9713f6fd82baf1eccd6a#%E8%BE%9E%E6%9B%B8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open(self.fullPathFileName, 'r') as f: | |
# note: 読み込むときは、まず read() は default のままでよい. | |
file_read = f.read() | |
# note: 次に、loads() の引数で,保存したときの文字コード 'utf-8' を使用し、最終的に読み込みをすれば良い. | |
# json.loads() : JSON形式の文字列を辞書に変換する | |
# json.loads(第一引数str or unicode, 第二引数encoding=None | |
# , cls=None, object_hook=None, parse_float=None | |
# , parse_int=None, parse_constant=None, object_pairs_hook=None, **kw | |
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
# selection 共通関数 v3 -flatten込み- | |
def commonCheckSelection(*args): | |
u""" <selection 共通関数 v3 -flatten込み> | |
:return selList: | |
:rtype selList: list of unicode | |
""" | |
selList = cmds.ls(sl = True, flatten = True) or [] | |
# print(selList) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = "if condition" | |
capitalized_string = string.capitalize() | |
print(capitalized_string) | |
#result, 'If condition' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################## | |
############# | |
# note: #### | |
############# | |
# mayaオリジナルの modules, scripts, plug-ins, icons フォルダについて。 | |
# これら4つは、明示的に、modファイルにパスが記述されていなくても、 | |
# パスが通るような設定らしい。 | |
# 存在しているという前提で、パス照会すると、現れる!!! | |
# 例えば、以下。 | |
# maya modules (modファイル) に、scripts フォルダの記述がなかったり、実際に scripts フォルダが存在していなくても、 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = 'a\tb\nA\tB' | |
print(s) | |
# a b | |
# A B | |
rs = r'a\tb\nA\tB' | |
print(rs) | |
# a\tb\nA\tB | |
print(type(rs)) |
OlderNewer