【发布时间】:2017-04-12 16:02:03
【问题描述】:
在 C 中,您可以通过以下方式访问字符串中您想要的位置:字符的地址:
&string[index]
例如这段代码:
#include <stdio.h>
int main()
{
char *foo = "abcdefgh";
printf("%s\n", &foo[2]);
}
将返回:
cdefgh
有没有办法在 Python 中做到这一点?
【问题讨论】:
标签: python c python-2.7 pointers slice