如何重写下面的代码?
self.view.frame = CGRectOffset(self.view.frame, 0, movement)
'Offset'已被'offsetby'替换
当我用所谓的“解决方案”替换它时:
self.view.frame = CGRect.offsetby(self.view.frame, 0, movement)
我收到错误:
“实例成员'offsetBy'不能用于'CGRect'类型;你的意思是使用这种类型的值吗?”
答案 0 :(得分:21)
您必须在CGRect
的实例上调用self.view.frame = self.view.frame.offsetBy(dx: 0, dy: movement)
。
import sys, os
# */site-packages is where your current session is running its python out of
site_path = ''
for path in sys.path:
if 'site-packages' in path.split('/')[-1]:
print(path)
site_path = path
# search to see if gensim in installed packages
if len(site_path) > 0:
if not 'gensim' in os.listdir(site_path):
print('package not found')
else:
print('gensim installed')