Skip to content

Instantly share code, notes, and snippets.

View 44hero's full-sized avatar

44hero 44hero

View GitHub Profile
# help()で出てこない関数(メソッド)の引数を調べる方法。
# import inspect
# inspect.getargspec(関数)
# (['self', 'arg0', 'arg1'], 'args', 'kwargs', (None,))
import inspect
inspect.getargspec(sss)
print(u'test')
# 多次元リストを一次元にする
import itertools
l_2d = [[0, 1], [2, 3]]
print(list(itertools.chain.from_iterable(l_2d)))
# [0, 1, 2, 3]
# OrderedDictを使用して、
# 例えば、
# ```python
# iniFileParam = {'geo_iFP': 'geometry',
# 'txtFldA_iFP': 'txtFldA_QLineEditWid',
# 'rbtnD_iFP': 'rbtnD_QRadioButton'
# }
# ```
# のような辞書の順番の番号で、keyやvalueを取得する方法は?
@44hero
44hero / for
Last active March 5, 2024 04:45
# 以下は同等である
print([index for index in objs])
for index in objs:
print(index)
参考サイトは以下
https://qiita.com/gold-kou/items/9713f6fd82baf1eccd6a#%E8%BE%9E%E6%9B%B8
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
# )
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)
string = "if condition"
capitalized_string = string.capitalize()
print(capitalized_string)
#result, 'If condition'
##################################################################################
#############
# note: ####
#############
# mayaオリジナルの modules, scripts, plug-ins, icons フォルダについて。
# これら4つは、明示的に、modファイルにパスが記述されていなくても、
# パスが通るような設定らしい。
# 存在しているという前提で、パス照会すると、現れる!!!
# 例えば、以下。
# maya modules (modファイル) に、scripts フォルダの記述がなかったり、実際に scripts フォルダが存在していなくても、
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))