当字符串文字跨越多行时,可以在python中使用三引号"""..."""
。
>>> string = """\
... Usage: thingy [OPTIONS]
... -h Display this usage message
... -H hostname Hostname to connect to
... """
>>>
R中有这样的可能吗?
答案 0 :(得分:4)
R字符串也支持这种行为:
private Entities AddToContext(Entities context, T entity, int count, int commitCount, bool recreateContext)
{
context.Set<T>().Add(entity);
if (count % commitCount == 0)
{
context.SaveChanges();
if (recreateContext)
{
context.Dispose();
context = new Entities();
context.Configuration.AutoDetectChangesEnabled = false;
}
}
return context;
}
<强>输出:强>
string <- "
... Usage: thingy [OPTIONS]
... -h Display this usage message
... -H hostname Hostname to connect to
... "
print(string)