0
我有一個字符串test_string像「你好,二是一些」」,我想第7位和12之間的字符複製在我使用的編程語言:蟒蛇複製串定位
test_string = 'Hello, two is a number'
new_string = string_copy(test_string, 7, 12)
new_string的值將是「兩我」。我的例子可能有點愚蠢,但在Python不函數存在等於string_copy?
這應該是'「你好,二是一些」 [ 6:12]'...問題假設基於1的索引和關閉[間隔](http://en.wikipedia.org/wiki/Interval_%28mathematics%29#Terminology)(這是合理的,只是不是Python如何做它),而Python的切片是[基於零](http://en.wikipedia.org/wiki/Zero-based_numbering)和半開放。 –
感謝您的答案,您的方法就像一個魅力。我檢查了確實使用基於1的索引的GML(Game Maker Language)文檔。 –