如何以编程方式确定ELisp中运行的Emacs操作系统?
我想.emacs
根据操作系统运行不同的代码.
我无法使用SQLAlchemy创建单个表.
我可以通过调用来创建它,Base.metadata.create_all(engine)
但随着表的数量增加,这个调用需要很长时间.
我动态创建表类,然后填充它们.
from sqlalchemy import create_engine, Column, Integer, Sequence, String, Date, Float, BIGINT
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class HistoricDay():
id = Column(Integer, Sequence('id_seq'), primary_key=True)
# Date, Open, High, Low, Close, Volume, Adj Close
date = Column(Date)
open = Column(Float)
high = Column(Float)
low = Column(Float)
close = Column(Float)
volume = Column(BIGINT)
adjClose = Column(Float)
def __init__(self, date, open, high, low, close, volume, adjClose):
self.date = date
self.open = open
self.high …
Run Code Online (Sandbox Code Playgroud) 现在我在*scratch*
缓冲区中编写表达式并通过评估来测试它们C-x C-e.我真的很感激有一个像SLIME或irb这样的交互式解释器,我可以在其中测试Emacs Lisp表达式.
我试图在推送时忽略一些文件夹,最后只有.gitignore
存储库中的文件夹.现在想要"重置"我的存储库(通过重置我的意思是删除我应用的所有规则并清理提交区域),这样我就可以添加所有文件并删除之后我不想要的文件夹.有帮助吗?
以下代码:
Base = declarative_base()
engine = create_engine(r"sqlite:///" + r"d:\foo.db",
listeners=[ForeignKeysListener()])
Session = sessionmaker(bind = engine)
ses = Session()
class Foo(Base):
__tablename__ = "foo"
id = Column(Integer, primary_key=True)
name = Column(String, unique = True)
class Bar(Base):
__tablename__ = "bar"
id = Column(Integer, primary_key = True)
foo_id = Column(Integer, ForeignKey("foo.id"))
foo = relationship("Foo")
class FooBar(Base):
__tablename__ = "foobar"
id = Column(Integer, primary_key = True)
bar_id = Column(Integer, ForeignKey("bar.id"))
bar = relationship("Bar")
Base.metadata.create_all(engine)
ses.query(FooBar).filter(FooBar.bar.foo.name == "blah")
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' …
Run Code Online (Sandbox Code Playgroud) 在Emacs中,我经常发现自己需要在各种源文件之间来回切换到各种终端.不过,我觉得我没有一个好办法,有效地做到这一点,它的笨拙,你只能打开一个壳在Emacs( ,shell
,eshell
或term
).
而且,我需要一种有效的方法来处理多个终端和源文件.
我怎样才能做到这一点?
嗨我ACTION_IMAGE_CAPTURE
用于捕获图像使用Intent
如下:
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(
MediaStore.EXTRA_OUTPUT, (new File(Environment.getExternalStorageDirectory(),
String.valueOf(System.currentTimeMillis()) + ".jpg"))
);
startActivityForResult(cameraIntent, 0);
Run Code Online (Sandbox Code Playgroud)
我需要将图像存储在SD卡中,并使用该onActivityResult
方法检索该图像的路径.我不知道如何获取当前捕获图像的图像路径.
如果有人知道请帮助.
谢谢
通过string.translate
功能说:
删除deletechars中的所有字符(如果存在),然后使用表转换字符,该表必须是256个字符的字符串,为每个字符值提供转换,并按其序号索引.如果table为None,则仅执行字符删除步骤.
dict
包含映射吗?string.maketrans
?我尝试使用该功能(尝试下面)只是为了看它是如何工作但是没能成功使用它.
>>> "abcabc".translate("abcabc",{ord("a"): "d", ord("c"): "x"})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: translation table must be 256 characters long
Run Code Online (Sandbox Code Playgroud)
>>> "abcabc".translate({ord("a"): ord("d"), ord("c"): ord("x")}, "b")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object
Run Code Online (Sandbox Code Playgroud)
>>> "abc".translate({"a": "d", "c": "x"}, ["b"])
Traceback (most recent call last):
File "<stdin>", line 1, in …
Run Code Online (Sandbox Code Playgroud) 我在理解Python的字节码及其dis
模块时遇到了很多困难.
import dis
def func():
x = 1
dis.dis(func)
Run Code Online (Sandbox Code Playgroud)
在解释器中输入上面的代码会产生以下输出:
0 LOAD_CONST 1(1)
3 STORE_FAST 0(x)
6 LOAD_CONST 0(NONE)
9 RETURN_VALUE
Run Code Online (Sandbox Code Playgroud)
例如:
是什么意思LOAD_CONST
,STORE_FAST
和喜欢的数字0
,3
,6
和9
?
我将非常感谢您可以找到此信息的特定资源.
python ×4
emacs ×3
elisp ×2
python-2.7 ×2
sqlalchemy ×2
android ×1
bytecode ×1
camera ×1
git ×1
haskell ×1
interpreter ×1
mysql ×1
python-3.x ×1
string ×1
syntax ×1